@manuscripts/style-guide 0.30.18 → 0.30.22

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.
Files changed (125) hide show
  1. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditor.js +3 -3
  2. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorItem.js +7 -6
  3. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorProfile.js +3 -3
  4. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorView.js +10 -40
  5. package/dist/cjs/components/AffiliationsEditor/styles.js +2 -1
  6. package/dist/cjs/components/AffiliationsList.js +3 -2
  7. package/dist/cjs/components/AlertMessage.js +9 -9
  8. package/dist/cjs/components/AuthorForm/AuthorForm.js +2 -1
  9. package/dist/cjs/components/AuthorForm/ContributorRolesSelect.js +6 -6
  10. package/dist/cjs/components/AuthorForm/RemoveAuthorButton.js +1 -1
  11. package/dist/cjs/components/AuthorForm/index.js +0 -1
  12. package/dist/cjs/components/AuthorName.js +2 -2
  13. package/dist/cjs/components/AuthorsContainer.js +5 -4
  14. package/dist/cjs/components/AuthorsDND/AuthorsDND.js +39 -17
  15. package/dist/cjs/components/AuthorsDND/DraggableAuthorItem.js +6 -25
  16. package/dist/cjs/components/AuthorsDND/index.js +5 -10
  17. package/dist/cjs/components/AuthorsList/Author.js +3 -2
  18. package/dist/cjs/components/AuthorsList/AuthorsList.js +4 -3
  19. package/dist/cjs/components/Avatar.js +5 -4
  20. package/dist/cjs/components/Button.js +15 -15
  21. package/dist/cjs/components/ColorField/ColorField.js +2 -1
  22. package/dist/cjs/components/ColorField/ColorSelector.js +8 -7
  23. package/dist/cjs/components/Comments/CommentActions.js +9 -12
  24. package/dist/cjs/components/Comments/CommentBody.js +5 -5
  25. package/dist/cjs/components/Comments/CommentTarget.js +1 -1
  26. package/dist/cjs/components/Comments/CommentUser.js +3 -2
  27. package/dist/cjs/components/Comments/CommentWrapper.js +18 -16
  28. package/dist/cjs/components/Comments/ResolveButton.js +3 -2
  29. package/dist/cjs/components/Dialog.js +2 -2
  30. package/dist/cjs/components/FileManager/ConfirmationPopUp.js +2 -1
  31. package/dist/cjs/components/FileManager/DragItemArea.js +2 -1
  32. package/dist/cjs/components/FileManager/FileManager.js +9 -8
  33. package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +5 -4
  34. package/dist/cjs/components/FileManager/FileSectionItem/DesignationActionsList.js +5 -4
  35. package/dist/cjs/components/FileManager/FileSectionItem/DragLayer.js +5 -4
  36. package/dist/cjs/components/FileManager/FileSectionItem/DraggableFileSectionItem.js +8 -7
  37. package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +3 -2
  38. package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +3 -2
  39. package/dist/cjs/components/FileManager/FileSectionItem/FileSectionUploadItem.js +3 -2
  40. package/dist/cjs/components/FileManager/FileSectionItem/FileTypeIcon.js +2 -1
  41. package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +5 -4
  42. package/dist/cjs/components/FileManager/FileSectionItem/ProgressBarUploadItem.js +2 -1
  43. package/dist/cjs/components/FileManager/FileSectionState.js +4 -2
  44. package/dist/cjs/components/FileManager/FilesSection.js +4 -3
  45. package/dist/cjs/components/FileManager/SelectDesignationActions.js +11 -11
  46. package/dist/cjs/components/FileManager/SelectDialogDesignation.js +3 -2
  47. package/dist/cjs/components/FileManager/UploadFileArea.js +11 -10
  48. package/dist/cjs/components/FileManager/util.js +15 -8
  49. package/dist/cjs/components/Form.js +1 -1
  50. package/dist/cjs/components/Inspector.js +7 -7
  51. package/dist/cjs/components/InspectorSection.js +5 -4
  52. package/dist/cjs/components/ManuscriptNoteList.js +17 -17
  53. package/dist/cjs/components/PdfPreview.js +13 -13
  54. package/dist/cjs/components/RadioButton.js +2 -1
  55. package/dist/cjs/components/RelativeDate.js +3 -2
  56. package/dist/cjs/components/SaveStatus.js +2 -1
  57. package/dist/cjs/components/SimpleModal.js +3 -2
  58. package/dist/cjs/components/StyledModal.js +3 -2
  59. package/dist/cjs/components/SubmissionInspector/BaseInformation.js +51 -24
  60. package/dist/cjs/components/SubmissionInspector/Button.js +2 -2
  61. package/dist/cjs/components/SubmissionInspector/Progress.js +6 -5
  62. package/dist/cjs/components/SubmissionInspector/Text.js +2 -2
  63. package/dist/cjs/components/TextField.js +3 -2
  64. package/dist/cjs/components/TextFieldContainer.js +2 -1
  65. package/dist/cjs/components/TextFieldError.js +2 -1
  66. package/dist/cjs/components/TextFieldGroupContainer.js +2 -1
  67. package/dist/cjs/components/Tip.js +7 -6
  68. package/dist/cjs/components/icons/back-arrow.js +2 -1
  69. package/dist/cjs/hooks/use-dropdown.js +6 -5
  70. package/dist/cjs/lib/authors.js +24 -15
  71. package/dist/cjs/lib/capabilities.js +13 -8
  72. package/dist/cjs/lib/comments.js +9 -5
  73. package/dist/cjs/lib/lw-errors-decoder.js +55 -0
  74. package/dist/cjs/lib/name.js +2 -1
  75. package/dist/es/components/AffiliationsEditor/AffiliationsEditorView.js +6 -36
  76. package/dist/es/components/AuthorForm/ContributorRolesSelect.js +1 -2
  77. package/dist/es/components/AuthorForm/index.js +0 -1
  78. package/dist/es/components/AuthorsContainer.js +2 -2
  79. package/dist/es/components/AuthorsDND/AuthorsDND.js +20 -16
  80. package/dist/es/components/AuthorsDND/DraggableAuthorItem.js +2 -2
  81. package/dist/es/components/AuthorsDND/index.js +1 -1
  82. package/dist/es/components/AuthorsList/AuthorsList.js +2 -2
  83. package/dist/es/components/Comments/CommentActions.js +1 -5
  84. package/dist/es/components/Comments/CommentWrapper.js +10 -9
  85. package/dist/es/components/FileManager/FileSectionItem/DragLayer.js +1 -1
  86. package/dist/es/components/FileManager/SelectDesignationActions.js +7 -8
  87. package/dist/es/components/PdfPreview.js +4 -4
  88. package/dist/es/components/SubmissionInspector/BaseInformation.js +33 -7
  89. package/dist/es/components/TextFieldContainer.js +1 -1
  90. package/dist/es/components/TextFieldGroupContainer.js +1 -1
  91. package/dist/es/lib/lw-errors-decoder.js +55 -0
  92. package/dist/types/components/AffiliationsEditor/AffiliationsEditorView.d.ts +4 -7
  93. package/dist/types/components/AffiliationsEditor/styles.d.ts +2 -2
  94. package/dist/types/components/AlertMessage.d.ts +1 -1
  95. package/dist/types/components/AuthorForm/index.d.ts +0 -1
  96. package/dist/types/components/AuthorsContainer.d.ts +1 -0
  97. package/dist/types/components/AuthorsDND/AuthorsDND.d.ts +2 -2
  98. package/dist/types/components/AuthorsDND/DraggableAuthorItem.d.ts +15 -5
  99. package/dist/types/components/AuthorsDND/index.d.ts +1 -1
  100. package/dist/types/components/AuthorsList/AuthorsList.d.ts +1 -0
  101. package/dist/types/components/Button.d.ts +9 -9
  102. package/dist/types/components/FileManager/util.d.ts +0 -1
  103. package/dist/types/components/Form.d.ts +1 -1
  104. package/dist/types/components/InspectorSection.d.ts +1 -1
  105. package/dist/types/components/PdfPreview.d.ts +1 -1
  106. package/dist/types/components/SimpleModal.d.ts +1 -1
  107. package/dist/types/components/SubmissionInspector/Button.d.ts +1 -1
  108. package/dist/types/components/icons/add-author.d.ts +0 -1
  109. package/dist/types/components/icons/add-icon-active.d.ts +0 -1
  110. package/dist/types/components/icons/add-icon-inverted.d.ts +0 -1
  111. package/dist/types/components/icons/back-arrow.d.ts +0 -1
  112. package/dist/types/components/icons/bookmark.d.ts +0 -1
  113. package/dist/types/components/icons/google.d.ts +0 -1
  114. package/dist/types/components/icons/orcid.d.ts +0 -1
  115. package/dist/types/components/icons/project-notification.d.ts +0 -1
  116. package/dist/types/components/icons/project.d.ts +0 -1
  117. package/dist/types/components/icons/projects-list.d.ts +0 -1
  118. package/dist/types/components/icons/search.d.ts +0 -1
  119. package/dist/types/components/icons/tick-mark.d.ts +0 -1
  120. package/dist/types/components/icons/user.d.ts +0 -1
  121. package/dist/types/lib/comments.d.ts +2 -2
  122. package/package.json +5 -5
  123. package/dist/cjs/components/AuthorForm/AffiliationsSelect.js +0 -55
  124. package/dist/es/components/AuthorForm/AffiliationsSelect.js +0 -49
  125. package/dist/types/components/AuthorForm/AffiliationsSelect.d.ts +0 -29
@@ -41,8 +41,8 @@ const react_1 = __importStar(require("react"));
41
41
  const authors_1 = require("../../lib/authors");
42
42
  const AffiliationsEditorView_1 = __importDefault(require("./AffiliationsEditorView"));
43
43
  const AffiliationsEditor = ({ affiliations, authorAffiliations, addAuthorAffiliation, updateAffiliation, removeAuthorAffiliation, components, styleOverrides, }) => {
44
- const [searchText, setSearchText] = react_1.useState('');
45
- const handleChoose = react_1.useCallback((value) => {
44
+ const [searchText, setSearchText] = (0, react_1.useState)('');
45
+ const handleChoose = (0, react_1.useCallback)((value) => {
46
46
  if (value) {
47
47
  const selectedAffiliation = value;
48
48
  addAuthorAffiliation(selectedAffiliation.__isNew__
@@ -51,7 +51,7 @@ const AffiliationsEditor = ({ affiliations, authorAffiliations, addAuthorAffilia
51
51
  }
52
52
  setSearchText('');
53
53
  }, [addAuthorAffiliation, affiliations]);
54
- const options = authors_1.affiliationsOptions(affiliations, authorAffiliations);
54
+ const options = (0, authors_1.affiliationsOptions)(affiliations, authorAffiliations);
55
55
  const active = authorAffiliations
56
56
  ? authorAffiliations.map((item) => item.data)
57
57
  : [];
@@ -62,7 +62,7 @@ const Title = styled_components_1.default.h4 `
62
62
  background: ${(props) => props.isInvalid ? props.theme.colors.background.warning : 'transparent'};
63
63
  color: ${(props) => props.isInvalid ? props.theme.colors.text.warning : 'inherit'};
64
64
  `;
65
- const DropdownIndicator = styled_components_1.default(ArrowDownBlue_1.default) `
65
+ const DropdownIndicator = (0, styled_components_1.default)(ArrowDownBlue_1.default) `
66
66
  border: 0;
67
67
  border-radius: 50%;
68
68
  margin-right: 0.6em;
@@ -106,13 +106,13 @@ const RemoveButton = styled_components_1.default.button `
106
106
  height: 2rem;
107
107
  }
108
108
  `;
109
- const AffiliationsForm = styled_components_1.default(formik_1.Form) `
109
+ const AffiliationsForm = (0, styled_components_1.default)(formik_1.Form) `
110
110
  border: 1px solid ${(props) => props.theme.colors.border.field.default};
111
111
  border-radius: ${(props) => props.theme.grid.radius.default};
112
112
  margin: 0.4rem 0.71rem 0.71rem;
113
113
  overflow: hidden;
114
114
  `;
115
- const AffiliationsTextField = styled_components_1.default(TextField_1.TextField) `
115
+ const AffiliationsTextField = (0, styled_components_1.default)(TextField_1.TextField) `
116
116
  border-radius: 0;
117
117
  border-bottom: none;
118
118
  border-right: none;
@@ -142,8 +142,8 @@ const Column = styled_components_1.default.div `
142
142
  border-left: none;
143
143
  }
144
144
  `;
145
- exports.AffiliationsEditorItem = ({ affiliation, requestToggle, isOpen, updateAffiliation, removeAuthorAffiliation, }) => {
146
- const remove = react_1.useCallback(() => {
145
+ const AffiliationsEditorItem = ({ affiliation, requestToggle, isOpen, updateAffiliation, removeAuthorAffiliation, }) => {
146
+ const remove = (0, react_1.useCallback)(() => {
147
147
  removeAuthorAffiliation(affiliation);
148
148
  }, [affiliation, removeAuthorAffiliation]);
149
149
  const vivifiedAffiliation = Object.assign({ institution: '', department: '', addressLine1: '', addressLine2: '', addressLine3: '', city: '', county: '', country: '', postCode: '' }, affiliation);
@@ -153,7 +153,7 @@ exports.AffiliationsEditorItem = ({ affiliation, requestToggle, isOpen, updateAf
153
153
  react_1.default.createElement(ToggleButton, { type: "button", onClick: requestToggle, isOpen: isOpen },
154
154
  react_1.default.createElement(DropdownIndicator, null,
155
155
  react_1.default.createElement(ArrowDownBlue_1.default, null)),
156
- authors_1.affiliationLabel(affiliation)),
156
+ (0, authors_1.affiliationLabel)(affiliation)),
157
157
  react_1.default.createElement(RemoveButton, { type: "button", "aria-label": "Delete this affiliation", onClick: remove },
158
158
  react_1.default.createElement(AnnotationRemove_1.default, null))),
159
159
  isOpen && (react_1.default.createElement(formik_1.Formik, { initialValues: vivifiedAffiliation, onSubmit: updateAffiliation }, () => (react_1.default.createElement(AffiliationsForm, null,
@@ -168,4 +168,5 @@ exports.AffiliationsEditorItem = ({ affiliation, requestToggle, isOpen, updateAf
168
168
  react_1.default.createElement(formik_1.Field, { name: "postCode" }, (props) => (react_1.default.createElement(AutoSaveInput_1.AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "Postal Code" })))),
169
169
  react_1.default.createElement(formik_1.Field, { name: "country" }, (props) => (react_1.default.createElement(AutoSaveInput_1.AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "Country" }))))))))))));
170
170
  };
171
+ exports.AffiliationsEditorItem = AffiliationsEditorItem;
171
172
  exports.default = exports.AffiliationsEditorItem;
@@ -41,8 +41,8 @@ const manuscripts_json_schema_1 = require("@manuscripts/manuscripts-json-schema"
41
41
  const react_1 = __importStar(require("react"));
42
42
  const AffiliationsEditorView_1 = __importDefault(require("./AffiliationsEditorView"));
43
43
  const AffiliationsEditorProfile = ({ affiliations, addAffiliation, updateAffiliation, removeAffiliation, components, styleOverrides, }) => {
44
- const [searchText, setSearchText] = react_1.useState('');
45
- const handleChoose = react_1.useCallback((value) => {
44
+ const [searchText, setSearchText] = (0, react_1.useState)('');
45
+ const handleChoose = (0, react_1.useCallback)((value) => {
46
46
  if (value) {
47
47
  const selectedAffiliation = value;
48
48
  addAffiliation(selectedAffiliation.value);
@@ -50,7 +50,7 @@ const AffiliationsEditorProfile = ({ affiliations, addAffiliation, updateAffilia
50
50
  setSearchText('');
51
51
  }, [addAffiliation]);
52
52
  const affiliationsArr = Array.from(affiliations.values());
53
- const updateUserProfileAffiliation = react_1.useCallback((data) => {
53
+ const updateUserProfileAffiliation = (0, react_1.useCallback)((data) => {
54
54
  updateAffiliation(Object.assign(Object.assign({}, data), { objectType: manuscripts_json_schema_1.ObjectTypes.UserProfileAffiliation }));
55
55
  }, [updateAffiliation]);
56
56
  return (react_1.default.createElement(AffiliationsEditorView_1.default, { options: [], selected: affiliationsArr, updateAffiliation: updateUserProfileAffiliation, removeAuthorAffiliation: removeAffiliation, components: components, styleOverrides: styleOverrides, handleChoose: handleChoose, handleInputChange: setSearchText, inputValue: searchText }));
@@ -37,56 +37,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
- const AddAuthor_1 = __importDefault(require("@manuscripts/assets/react/AddAuthor"));
41
40
  const react_1 = __importStar(require("react"));
42
41
  const creatable_1 = __importDefault(require("react-select/creatable"));
43
- const styled_components_1 = __importStar(require("styled-components"));
42
+ const styled_components_1 = require("styled-components");
44
43
  const AuthorFormComponents_1 = require("../AuthorForm/AuthorFormComponents");
45
44
  const AffiliationsEditorItem_1 = require("./AffiliationsEditorItem");
46
- const Container = styled_components_1.default.div `
47
- margin: 0 1.89rem 1rem;
48
- `;
49
- const Field = styled_components_1.default.div `
50
- margin: 1rem 0;
51
- `;
52
- const List = styled_components_1.default.div `
53
- margin-bottom: 0.5rem;
54
- `;
55
- const AddAffiliationContainer = styled_components_1.default.div `
56
- padding-right: 0.71rem;
57
- display: flex;
58
- flex-direction: column;
59
- justify-content: space-around;
60
-
61
- svg {
62
- width: 1.5rem;
63
- height: 1.5rem;
64
- }
65
-
66
- circle,
67
- use {
68
- fill: ${(props) => props.theme.colors.brand.default};
69
- }
70
-
71
- path {
72
- mask: none;
73
- }
74
- `;
75
- const AddAffiliationIndicator = () => (react_1.default.createElement(AddAffiliationContainer, null,
76
- react_1.default.createElement(AddAuthor_1.default, null)));
45
+ const styles_1 = require("./styles");
77
46
  const reactSelectComponents = {
78
- IndicatorsContainer: AddAffiliationIndicator,
47
+ IndicatorsContainer: styles_1.AddAffiliationIndicator,
79
48
  };
80
- const AffiliationsEditorView = ({ options, selected, updateAffiliation, removeAuthorAffiliation, handleChoose, handleInputChange, inputValue, theme, components, styleOverrides, }) => {
49
+ const AffiliationsEditorView = ({ options, selected, updateAffiliation, removeAuthorAffiliation, handleChoose, handleInputChange, inputValue, components, styleOverrides, }) => {
81
50
  const { Legend } = Object.assign(Object.assign({}, AuthorFormComponents_1.defaultAuthorFormComponents), components);
82
- const [currentSection, setCurrentSection] = react_1.useState('');
51
+ const [currentSection, setCurrentSection] = (0, react_1.useState)('');
83
52
  const requestOpen = (id) => {
84
53
  setCurrentSection(id === currentSection ? '' : id);
85
54
  };
86
- return (react_1.default.createElement(Container, null,
55
+ const theme = (0, react_1.useContext)(styled_components_1.ThemeContext);
56
+ return (react_1.default.createElement(styles_1.Container, null,
87
57
  react_1.default.createElement(Legend, null, "Affiliations"),
88
- react_1.default.createElement(Field, null,
89
- react_1.default.createElement(List, null, selected &&
58
+ react_1.default.createElement(styles_1.Field, null,
59
+ react_1.default.createElement(styles_1.List, null, selected &&
90
60
  selected.map((affiliation) => {
91
61
  const { _id } = affiliation;
92
62
  return (react_1.default.createElement(AffiliationsEditorItem_1.AffiliationsEditorItem, { key: _id, affiliation: affiliation, isOpen: currentSection === _id, requestToggle: () => requestOpen(_id), updateAffiliation: updateAffiliation, removeAuthorAffiliation: removeAuthorAffiliation }));
@@ -103,4 +73,4 @@ const AffiliationsEditorView = ({ options, selected, updateAffiliation, removeAu
103
73
  provided.zIndex })),
104
74
  } }))));
105
75
  };
106
- exports.default = styled_components_1.withTheme(AffiliationsEditorView);
76
+ exports.default = AffiliationsEditorView;
@@ -51,5 +51,6 @@ exports.AddAffiliationContainer = styled_components_1.default.div `
51
51
  mask: none;
52
52
  }
53
53
  `;
54
- exports.AddAffiliationIndicator = () => (react_1.default.createElement(exports.AddAffiliationContainer, null,
54
+ const AddAffiliationIndicator = () => (react_1.default.createElement(exports.AddAffiliationContainer, null,
55
55
  react_1.default.createElement(AddAuthor_1.default, null)));
56
+ exports.AddAffiliationIndicator = AddAffiliationIndicator;
@@ -36,7 +36,8 @@ const Header = styled_components_1.default.th `
36
36
  const Body = styled_components_1.default.td `
37
37
  padding: 0;
38
38
  `;
39
- exports.AffiliationsList = ({ affiliations, }) => (react_1.default.createElement(Container, null,
39
+ const AffiliationsList = ({ affiliations, }) => (react_1.default.createElement(Container, null,
40
40
  react_1.default.createElement("tbody", null, Array.from(affiliations.values()).map((affiliation, index) => (react_1.default.createElement("tr", { key: affiliation._id },
41
41
  react_1.default.createElement(Header, null, index + 1),
42
- react_1.default.createElement(Body, null, formatAddress_1.default(affiliation))))))));
42
+ react_1.default.createElement(Body, null, (0, formatAddress_1.default)(affiliation))))))));
43
+ exports.AffiliationsList = AffiliationsList;
@@ -47,7 +47,7 @@ const react_1 = __importDefault(require("react"));
47
47
  const react_sizeme_1 = require("react-sizeme");
48
48
  const styled_components_1 = __importStar(require("styled-components"));
49
49
  const Button_1 = require("./Button");
50
- const buttonStyles = styled_components_1.css `
50
+ const buttonStyles = (0, styled_components_1.css) `
51
51
  color: inherit;
52
52
  margin-left: ${(props) => props.theme.grid.unit * 4}px;
53
53
 
@@ -61,10 +61,10 @@ const buttonStyles = styled_components_1.css `
61
61
  filter: brightness(80%);
62
62
  }
63
63
  `;
64
- exports.TextButton = styled_components_1.default(Button_1.IconTextButton) `
64
+ exports.TextButton = (0, styled_components_1.default)(Button_1.IconTextButton) `
65
65
  ${buttonStyles}
66
66
  `;
67
- const CloseIconButton = styled_components_1.default(Button_1.IconButton).attrs({
67
+ const CloseIconButton = (0, styled_components_1.default)(Button_1.IconButton).attrs({
68
68
  defaultColor: true,
69
69
  size: 16,
70
70
  }) `
@@ -93,22 +93,22 @@ const BaseAlertContainer = styled_components_1.default.div `
93
93
  padding: ${(props) => props.theme.grid.unit * 3}px;
94
94
  white-space: normal;
95
95
  `;
96
- const SuccessAlertContainer = styled_components_1.default(BaseAlertContainer) `
96
+ const SuccessAlertContainer = (0, styled_components_1.default)(BaseAlertContainer) `
97
97
  background-color: ${(props) => props.theme.colors.background.success};
98
98
  border: solid 1px ${(props) => props.theme.colors.border.success};
99
99
  color: ${(props) => props.theme.colors.text.success};
100
100
  `;
101
- const ErrorAlertContainer = styled_components_1.default(BaseAlertContainer) `
101
+ const ErrorAlertContainer = (0, styled_components_1.default)(BaseAlertContainer) `
102
102
  background-color: ${(props) => props.theme.colors.background.error};
103
103
  border: solid 1px ${(props) => props.theme.colors.border.error};
104
104
  color: ${(props) => props.theme.colors.text.error};
105
105
  `;
106
- const InfoAlertContainer = styled_components_1.default(BaseAlertContainer) `
106
+ const InfoAlertContainer = (0, styled_components_1.default)(BaseAlertContainer) `
107
107
  background-color: ${(props) => props.theme.colors.background.info};
108
108
  border: solid 1px ${(props) => props.theme.colors.border.info};
109
109
  color: ${(props) => props.theme.colors.text.info};
110
110
  `;
111
- const WarningAlertContainer = styled_components_1.default(BaseAlertContainer) `
111
+ const WarningAlertContainer = (0, styled_components_1.default)(BaseAlertContainer) `
112
112
  background-color: ${(props) => props.theme.colors.background.warning};
113
113
  border: solid 1px ${(props) => props.theme.colors.border.warning};
114
114
  color: ${(props) => props.theme.colors.text.warning};
@@ -119,10 +119,10 @@ const TextContainer = styled_components_1.default.div `
119
119
  align-items: center;
120
120
  word-break: break-word;
121
121
  `;
122
- const SuccessIcon = styled_components_1.default(SuccessGreen_1.default) `
122
+ const SuccessIcon = (0, styled_components_1.default)(SuccessGreen_1.default) `
123
123
  transform: scale(0.75, 0.75);
124
124
  `;
125
- const CloseIcon = styled_components_1.default(CloseIconDark_1.default) `
125
+ const CloseIcon = (0, styled_components_1.default)(CloseIconDark_1.default) `
126
126
  width: 100%;
127
127
  height: 100%;
128
128
  `;
@@ -65,7 +65,7 @@ const OrcidContainer = styled_components_1.default.div `
65
65
  const RolesContainer = styled_components_1.default.div `
66
66
  margin: 16px 0;
67
67
  `;
68
- exports.AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, handleRemoveAuthor, components, contributorRoles = [], createContributorRole, }) => {
68
+ const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, handleRemoveAuthor, components, contributorRoles = [], createContributorRole, }) => {
69
69
  const { Legend, TextField } = Object.assign(Object.assign({}, AuthorFormComponents_1.defaultAuthorFormComponents), components);
70
70
  return (react_1.default.createElement(formik_1.Formik, { initialValues: buildInitialValues(author), onSubmit: handleSave, enableReinitialize: true }, ({ values }) => {
71
71
  const isAuthor = values.role === 'author';
@@ -111,3 +111,4 @@ exports.AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, ha
111
111
  }), placeholder: 'If needed, describe contributions in more detail…' })))))))));
112
112
  }));
113
113
  };
114
+ exports.AuthorForm = AuthorForm;
@@ -50,12 +50,12 @@ exports.ContributorRolesSelect = void 0;
50
50
  const react_1 = __importStar(require("react"));
51
51
  const creatable_1 = __importDefault(require("react-select/creatable"));
52
52
  const sortRolesAlphabetical = (a, b) => a.name.localeCompare(b.name);
53
- exports.ContributorRolesSelect = ({ contributorRoles, createContributorRole, value, setFieldValue }) => {
54
- const [saving, setSaving] = react_1.useState(false);
55
- const selectedRoles = react_1.useMemo(() => value
53
+ const ContributorRolesSelect = ({ contributorRoles, createContributorRole, value, setFieldValue }) => {
54
+ const [saving, setSaving] = (0, react_1.useState)(false);
55
+ const selectedRoles = (0, react_1.useMemo)(() => value
56
56
  .map((id) => contributorRoles.find((item) => item._id === id))
57
57
  .flat(), [contributorRoles, value]);
58
- const options = react_1.useMemo(() => {
58
+ const options = (0, react_1.useMemo)(() => {
59
59
  const output = { local: [], 'dictionary.casrai.org': [] };
60
60
  const groupedOptions = contributorRoles.reduce((output, contributorRole) => {
61
61
  if (contributorRole.uri) {
@@ -90,7 +90,7 @@ exports.ContributorRolesSelect = ({ contributorRoles, createContributorRole, val
90
90
  setSaving(false);
91
91
  setFieldValue([...value, contribution._id]);
92
92
  }), getOptionValue: (option) => option._id, getOptionLabel: (option) => option.name, onChange: (value) => {
93
- const items = value;
94
- setFieldValue(items.map((item) => item._id));
93
+ setFieldValue(value.map((item) => item._id));
95
94
  } }));
96
95
  };
96
+ exports.ContributorRolesSelect = ContributorRolesSelect;
@@ -39,7 +39,7 @@ class RemoveAuthorButton extends react_1.default.Component {
39
39
  };
40
40
  return (react_1.default.createElement(react_1.default.Fragment, null,
41
41
  react_1.default.createElement(Button_1.PrimaryButton, { danger: true, onClick: this.props.handleOpen }, "Delete"),
42
- isOpen && (react_1.default.createElement(Dialog_1.Dialog, { isOpen: isOpen, actions: actions, category: Dialog_1.Category.confirmation, header: 'Remove author', message: `Are you sure you want to remove ${name_1.initials(author.bibliographicName)}${' '}${author.bibliographicName.family} from the authors list?` }))));
42
+ isOpen && (react_1.default.createElement(Dialog_1.Dialog, { isOpen: isOpen, actions: actions, category: Dialog_1.Category.confirmation, header: 'Remove author', message: `Are you sure you want to remove ${(0, name_1.initials)(author.bibliographicName)}${' '}${author.bibliographicName.family} from the authors list?` }))));
43
43
  }
44
44
  }
45
45
  exports.default = RemoveAuthorButton;
@@ -26,4 +26,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  __exportStar(require("./AuthorForm"), exports);
29
- __exportStar(require("./AffiliationsSelect"), exports);
@@ -42,7 +42,7 @@ const react_1 = __importDefault(require("react"));
42
42
  const styled_components_1 = __importStar(require("styled-components"));
43
43
  const name_1 = require("../lib/name");
44
44
  const NameParts = styled_components_1.default.span ``;
45
- const buildNameLiteral = (name) => [name_1.initials(name), name.family, name.suffix].filter((part) => part).join(' ');
45
+ const buildNameLiteral = (name) => [(0, name_1.initials)(name), name.family, name.suffix].filter((part) => part).join(' ');
46
46
  const AuthorNameComponent = ({ name, email, theme }) => !name.given && !name.family ? (react_1.default.createElement(NameParts, { color: theme.colors.text.secondary, "data-testid": `author-name--unknown` }, "Unknown Author")) : (react_1.default.createElement(NameParts, { "data-testid": `author-name--${name.given}` }, (email && buildNameLiteral(name).concat(' ').concat(`(${email})`)) ||
47
47
  buildNameLiteral(name)));
48
- exports.AuthorName = styled_components_1.withTheme(AuthorNameComponent);
48
+ exports.AuthorName = (0, styled_components_1.withTheme)(AuthorNameComponent);
@@ -42,16 +42,17 @@ const react_1 = __importStar(require("react"));
42
42
  const styled_components_1 = __importDefault(require("styled-components"));
43
43
  const AffiliationsList_1 = require("./AffiliationsList");
44
44
  const AuthorsList_1 = require("./AuthorsList");
45
- exports.AuthorsContainer = ({ authorData, showEditButton, startEditing, selectAuthor }) => {
46
- const authorAffiliations = react_1.useMemo(() => authorData.authors.filter((author) => author.role === 'author'), [authorData.authors]);
47
- const isThereJointContributor = react_1.useMemo(() => authorData.authors.find((contributor) => contributor.isJointContributor), [authorData.authors]);
45
+ const AuthorsContainer = ({ authorData, showEditButton, startEditing, selectAuthor, disableEditButton, }) => {
46
+ const authorAffiliations = (0, react_1.useMemo)(() => authorData.authors.filter((author) => author.role === 'author'), [authorData.authors]);
47
+ const isThereJointContributor = (0, react_1.useMemo)(() => authorData.authors.find((contributor) => contributor.isJointContributor), [authorData.authors]);
48
48
  return (react_1.default.createElement(Container, { "data-cy": 'author-container' },
49
- react_1.default.createElement(AuthorsList_1.AuthorsList, { authors: authorAffiliations, authorAffiliations: authorData.authorAffiliations, startEditing: startEditing, showEditButton: showEditButton, selectAuthor: selectAuthor }),
49
+ react_1.default.createElement(AuthorsList_1.AuthorsList, { authors: authorAffiliations, authorAffiliations: authorData.authorAffiliations, startEditing: startEditing, showEditButton: showEditButton, selectAuthor: selectAuthor, disableEditButton: disableEditButton }),
50
50
  react_1.default.createElement(AffiliationsList_1.AffiliationsList, { affiliations: authorData.affiliations }),
51
51
  isThereJointContributor && (react_1.default.createElement(LegendWrapper, null,
52
52
  react_1.default.createElement(Legend, null, "\u2020"),
53
53
  "These authors contributed equally to this work."))));
54
54
  };
55
+ exports.AuthorsContainer = AuthorsContainer;
55
56
  const Container = styled_components_1.default.div `
56
57
  margin-top: ${(props) => props.theme.grid.unit * 4}px;
57
58
  `;
@@ -14,29 +14,51 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
17
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
38
  };
20
39
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.AuthorsDND = void 0;
22
- const react_1 = __importDefault(require("react"));
23
- const styled_components_1 = __importDefault(require("styled-components"));
40
+ const react_1 = __importStar(require("react"));
41
+ const styled_components_1 = __importStar(require("styled-components"));
24
42
  const DraggableAuthorItem_1 = __importDefault(require("./DraggableAuthorItem"));
25
43
  const SidebarList = styled_components_1.default.div `
26
44
  flex: 1;
27
45
  overflow-y: visible;
28
46
  `;
29
- exports.AuthorsDND = ({ authors, selectAuthor, selectedAuthor, handleDrop, getSidebarItemDecorator, components, }) => (react_1.default.createElement(SidebarList, null, authors.map((author, index) => {
30
- const user = {
31
- _id: author.userID,
32
- };
33
- const authorItem = {
34
- _id: author._id,
35
- priority: author.priority || null,
36
- index,
37
- };
38
- const decorator = getSidebarItemDecorator
39
- ? getSidebarItemDecorator(author._id)
40
- : null;
41
- return (react_1.default.createElement(DraggableAuthorItem_1.default, { key: author._id, authorItem: authorItem, onDrop: handleDrop, author: author, authors: authors, user: user, selectedAuthor: selectedAuthor, selectAuthor: selectAuthor, sidebarItemDecorator: decorator, components: components }));
42
- })));
47
+ const AuthorsDND = ({ authors, selectAuthor, selectedAuthor, handleDrop, getSidebarItemDecorator, components, }) => {
48
+ const theme = (0, react_1.useContext)(styled_components_1.ThemeContext);
49
+ return (react_1.default.createElement(SidebarList, null, authors.map((author, index) => {
50
+ const user = {
51
+ _id: author.userID,
52
+ };
53
+ const authorItem = {
54
+ _id: author._id,
55
+ priority: author.priority || null,
56
+ index,
57
+ };
58
+ const decorator = getSidebarItemDecorator
59
+ ? getSidebarItemDecorator(author._id)
60
+ : null;
61
+ return (react_1.default.createElement(DraggableAuthorItem_1.default, { key: author._id, authorItem: authorItem, onDrop: handleDrop, author: author, authors: authors, user: user, selectedAuthor: selectedAuthor, selectAuthor: selectAuthor, sidebarItemDecorator: decorator, components: components, theme: theme }));
62
+ })));
63
+ };
64
+ exports.default = AuthorsDND;
@@ -14,25 +14,6 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
17
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
19
  };
@@ -43,7 +24,7 @@ const VerticalEllipsis_1 = __importDefault(require("@manuscripts/assets/react/Ve
43
24
  const react_1 = __importDefault(require("react"));
44
25
  const react_dnd_1 = require("react-dnd");
45
26
  const react_dom_1 = require("react-dom");
46
- const styled_components_1 = __importStar(require("styled-components"));
27
+ const styled_components_1 = __importDefault(require("styled-components"));
47
28
  const authors_1 = require("../../lib/authors");
48
29
  const Avatar_1 = require("../Avatar");
49
30
  const AuthorItemComponents_1 = require("./AuthorItemComponents");
@@ -124,7 +105,7 @@ const dropTargetSpec = {
124
105
  if (!monitor.isOver({ shallow: true })) {
125
106
  return;
126
107
  }
127
- const hoveredNode = react_dom_1.findDOMNode(component);
108
+ const hoveredNode = (0, react_dom_1.findDOMNode)(component);
128
109
  const { top, bottom } = hoveredNode.getBoundingClientRect();
129
110
  const offset = monitor.getClientOffset();
130
111
  if (!offset) {
@@ -187,7 +168,7 @@ class AuthorComponent extends react_1.default.Component {
187
168
  react_1.default.createElement(AuthorNotes, null,
188
169
  author.isCorresponding && (react_1.default.createElement(AuthorBadge, null,
189
170
  react_1.default.createElement(CorrespondingAuthorBadge_1.default, null))),
190
- authors_1.isJointFirstAuthor(authors, authorItem.index) && (react_1.default.createElement(AuthorBadge, null,
171
+ (0, authors_1.isJointFirstAuthor)(authors, authorItem.index) && (react_1.default.createElement(AuthorBadge, null,
191
172
  react_1.default.createElement(FirstAuthorBadge_1.default, null))))),
192
173
  react_1.default.createElement(AuthorNameSpace, null,
193
174
  react_1.default.createElement(AuthorName, { name: author.bibliographicName }))),
@@ -210,7 +191,7 @@ const dropTargetCollector = (connect, monitor) => ({
210
191
  canDrop: monitor.canDrop(),
211
192
  });
212
193
  const dragType = 'authorItem';
213
- const dragSource = react_dnd_1.DragSource(dragType, dragSourceSpec, dragSourceCollector);
214
- const dropTarget = react_dnd_1.DropTarget(dragType, dropTargetSpec, dropTargetCollector);
194
+ const dragSource = (0, react_dnd_1.DragSource)(dragType, dragSourceSpec, dragSourceCollector);
195
+ const dropTarget = (0, react_dnd_1.DropTarget)(dragType, dropTargetSpec, dropTargetCollector);
215
196
  const DraggableAuthorItem = dragSource(dropTarget(AuthorComponent));
216
- exports.default = styled_components_1.withTheme(DraggableAuthorItem);
197
+ exports.default = DraggableAuthorItem;
@@ -14,15 +14,10 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
19
  };
27
20
  Object.defineProperty(exports, "__esModule", { value: true });
28
- __exportStar(require("./AuthorsDND"), exports);
21
+ exports.AuthorsDND = void 0;
22
+ var AuthorsDND_1 = require("./AuthorsDND");
23
+ Object.defineProperty(exports, "AuthorsDND", { enumerable: true, get: function () { return __importDefault(AuthorsDND_1).default; } });
@@ -47,7 +47,7 @@ const AuthorNotes = styled_components_1.default.span `
47
47
  line-height: 1;
48
48
  vertical-align: top;
49
49
  `;
50
- const LinkSharedStyles = styled_components_1.css `
50
+ const LinkSharedStyles = (0, styled_components_1.css) `
51
51
  text-decoration: none;
52
52
  color: inherit;
53
53
  outline: none;
@@ -71,7 +71,7 @@ const AuthorsContainer = styled_components_1.default.a `
71
71
  cursor: pointer;
72
72
  }
73
73
  `;
74
- exports.Author = ({ author, affiliations, jointFirstAuthor, startEditing, selectAuthor, showEditButton, }) => (react_1.default.createElement("span", { key: author._id },
74
+ const Author = ({ author, affiliations, jointFirstAuthor, startEditing, selectAuthor, showEditButton, }) => (react_1.default.createElement("span", { key: author._id },
75
75
  showEditButton ? (react_1.default.createElement(AuthorsContainer, { href: "#", onClick: (e) => {
76
76
  e.preventDefault();
77
77
  startEditing && startEditing();
@@ -83,4 +83,5 @@ exports.Author = ({ author, affiliations, jointFirstAuthor, startEditing, select
83
83
  react_1.default.createElement(AuthorAffiliation, null, affiliation.ordinal)))))),
84
84
  author.isCorresponding && (react_1.default.createElement(AuthorNotes, { title: 'Corresponding author' }, "*")),
85
85
  jointFirstAuthor && (react_1.default.createElement(AuthorNotes, { title: 'Joint contributor' }, "\u2020"))));
86
+ exports.Author = Author;
86
87
  exports.default = exports.Author;
@@ -43,9 +43,10 @@ const AuthorsActions = styled_components_1.default.div `
43
43
  display: flex;
44
44
  margin-left: ${(props) => props.theme.grid.unit * 2}px;
45
45
  `;
46
- exports.AuthorsList = ({ authors, authorAffiliations, startEditing, showEditButton, selectAuthor, }) => (react_1.default.createElement(AuthorsContainer, { isEmpty: !authors.length },
46
+ const AuthorsList = ({ authors, authorAffiliations, startEditing, showEditButton, disableEditButton, selectAuthor, }) => (react_1.default.createElement(AuthorsContainer, { isEmpty: !authors.length },
47
47
  react_1.default.createElement("div", null, authors.map((author, index) => (react_1.default.createElement(react_1.default.Fragment, { key: author._id },
48
48
  !!index && ', ',
49
- react_1.default.createElement(Author_1.Author, { author: author, jointFirstAuthor: authors_1.isJointFirstAuthor(authors, index), affiliations: authorAffiliations.get(author._id), selectAuthor: selectAuthor, startEditing: startEditing, showEditButton: showEditButton }))))),
49
+ react_1.default.createElement(Author_1.Author, { author: author, jointFirstAuthor: (0, authors_1.isJointFirstAuthor)(authors, index), affiliations: authorAffiliations.get(author._id), selectAuthor: selectAuthor, startEditing: startEditing, showEditButton: showEditButton }))))),
50
50
  showEditButton && startEditing && (react_1.default.createElement(AuthorsActions, null,
51
- react_1.default.createElement(Button_1.PrimaryButton, { mini: true, onClick: startEditing }, "Edit Authors")))));
51
+ react_1.default.createElement(Button_1.PrimaryButton, { mini: true, onClick: startEditing, className: 'edit_authors_button', disabled: disableEditButton }, "Edit Authors")))));
52
+ exports.AuthorsList = AuthorsList;
@@ -54,7 +54,7 @@ const RoundedImage = styled_components_1.default.img `
54
54
  align-items: center;
55
55
  justify-content: center;
56
56
  `;
57
- const StyledAvatar = styled_components_1.default(AvatarNormal_1.default) `
57
+ const StyledAvatar = (0, styled_components_1.default)(AvatarNormal_1.default) `
58
58
  path {
59
59
  fill: ${(props) => props.color || props.theme.colors.text.secondary};
60
60
  }
@@ -63,10 +63,11 @@ const StyledAvatar = styled_components_1.default(AvatarNormal_1.default) `
63
63
  fill: ${(props) => props.color || props.theme.colors.text.info};
64
64
  }
65
65
  `;
66
- exports.Avatar = (props) => {
67
- const [srcError, setSrcError] = react_1.useState(false);
68
- const handleSrcError = react_1.useCallback(() => {
66
+ const Avatar = (props) => {
67
+ const [srcError, setSrcError] = (0, react_1.useState)(false);
68
+ const handleSrcError = (0, react_1.useCallback)(() => {
69
69
  setSrcError(true);
70
70
  }, []);
71
71
  return (react_1.default.createElement(AvatarContainer, null, props.src && !srcError ? (react_1.default.createElement(RoundedImage, { src: props.src, size: props.size, onError: handleSrcError })) : (react_1.default.createElement(StyledAvatar, { height: props.size, width: props.size, color: props.color }))));
72
72
  };
73
+ exports.Avatar = Avatar;