@manuscripts/body-editor 2.7.7 → 2.7.8-LEAN-4213.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.
Files changed (72) hide show
  1. package/dist/cjs/components/affiliations/AffiliationForm.js +106 -0
  2. package/dist/cjs/components/affiliations/AffiliationItem.js +112 -0
  3. package/dist/cjs/components/affiliations/AffiliationList.js +47 -0
  4. package/dist/cjs/components/affiliations/AffiliationsModal.js +418 -0
  5. package/dist/cjs/components/authors/AuthorDetailsForm.js +10 -2
  6. package/dist/cjs/components/authors/AuthorList.js +1 -1
  7. package/dist/cjs/components/authors/AuthorsModal.js +184 -80
  8. package/dist/cjs/components/authors/DraggableAuthor.js +0 -3
  9. package/dist/cjs/components/dialog/ConfirmationDialog.js +86 -0
  10. package/dist/cjs/components/form/FormFooter.js +32 -0
  11. package/dist/cjs/components/form/FormPlaceholder.js +43 -0
  12. package/dist/cjs/components/{authors/AuthorActions.js → form/ModalFormActions.js} +12 -11
  13. package/dist/cjs/plugins/affiliations.js +5 -38
  14. package/dist/cjs/useEditor.js +0 -1
  15. package/dist/cjs/versions.js +1 -1
  16. package/dist/cjs/views/affiliations.js +82 -14
  17. package/dist/cjs/views/contributors.js +1 -9
  18. package/dist/es/components/affiliations/AffiliationForm.js +76 -0
  19. package/dist/es/components/affiliations/AffiliationItem.js +82 -0
  20. package/dist/es/components/affiliations/AffiliationList.js +40 -0
  21. package/dist/es/components/affiliations/AffiliationsModal.js +388 -0
  22. package/dist/es/components/authors/AuthorDetailsForm.js +11 -3
  23. package/dist/es/components/authors/AuthorList.js +1 -1
  24. package/dist/es/components/authors/AuthorsModal.js +183 -79
  25. package/dist/es/components/authors/DraggableAuthor.js +0 -3
  26. package/dist/es/components/dialog/ConfirmationDialog.js +79 -0
  27. package/dist/es/components/form/FormFooter.js +27 -0
  28. package/dist/es/components/form/FormPlaceholder.js +36 -0
  29. package/dist/es/components/{authors/AuthorActions.js → form/ModalFormActions.js} +10 -9
  30. package/dist/es/plugins/affiliations.js +6 -39
  31. package/dist/es/useEditor.js +0 -1
  32. package/dist/es/versions.js +1 -1
  33. package/dist/es/views/affiliations.js +85 -17
  34. package/dist/es/views/contributors.js +1 -9
  35. package/dist/types/components/{authors → affiliations}/AffiliationForm.d.ts +5 -0
  36. package/dist/types/components/affiliations/AffiliationItem.d.ts +10 -0
  37. package/dist/types/components/affiliations/AffiliationList.d.ts +26 -0
  38. package/dist/types/components/affiliations/AffiliationsModal.d.ts +11 -0
  39. package/dist/types/components/authors/AuthorDetailsForm.d.ts +1 -0
  40. package/dist/types/components/authors/AuthorsModal.d.ts +2 -1
  41. package/dist/types/components/dialog/ConfirmationDialog.d.ts +15 -0
  42. package/dist/types/components/form/FormFooter.d.ts +5 -0
  43. package/dist/types/components/form/FormPlaceholder.d.ts +9 -0
  44. package/dist/types/components/{authors/AuthorActions.d.ts → form/ModalFormActions.d.ts} +4 -3
  45. package/dist/types/lib/dnd.d.ts +1 -1
  46. package/dist/types/selection.d.ts +7 -1
  47. package/dist/types/versions.d.ts +1 -1
  48. package/dist/types/views/affiliations.d.ts +11 -0
  49. package/dist/types/views/contributors.d.ts +0 -1
  50. package/package.json +2 -2
  51. package/styles/AdvancedEditor.css +8 -4
  52. package/styles/Editor.css +7 -0
  53. package/dist/cjs/components/authors/AffiliationButton.js +0 -104
  54. package/dist/cjs/components/authors/AffiliationForm.js +0 -50
  55. package/dist/cjs/components/authors/AuthorAffiliations.js +0 -120
  56. package/dist/cjs/components/authors/AuthorFormPlaceholder.js +0 -71
  57. package/dist/cjs/components/authors/DeleteAuthorConfirmationDialog.js +0 -36
  58. package/dist/cjs/components/authors/RequiredFieldConfirmationDialog.js +0 -39
  59. package/dist/cjs/components/authors/SaveAuthorConfirmationDialog.js +0 -39
  60. package/dist/es/components/authors/AffiliationButton.js +0 -74
  61. package/dist/es/components/authors/AffiliationForm.js +0 -43
  62. package/dist/es/components/authors/AuthorAffiliations.js +0 -89
  63. package/dist/es/components/authors/AuthorFormPlaceholder.js +0 -64
  64. package/dist/es/components/authors/DeleteAuthorConfirmationDialog.js +0 -29
  65. package/dist/es/components/authors/RequiredFieldConfirmationDialog.js +0 -32
  66. package/dist/es/components/authors/SaveAuthorConfirmationDialog.js +0 -32
  67. package/dist/types/components/authors/AffiliationButton.d.ts +0 -8
  68. package/dist/types/components/authors/AuthorAffiliations.d.ts +0 -11
  69. package/dist/types/components/authors/AuthorFormPlaceholder.d.ts +0 -2
  70. package/dist/types/components/authors/DeleteAuthorConfirmationDialog.d.ts +0 -7
  71. package/dist/types/components/authors/RequiredFieldConfirmationDialog.d.ts +0 -7
  72. package/dist/types/components/authors/SaveAuthorConfirmationDialog.d.ts +0 -7
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.AffiliationForm = void 0;
30
+ const style_guide_1 = require("@manuscripts/style-guide");
31
+ const formik_1 = require("formik");
32
+ const react_1 = __importStar(require("react"));
33
+ const styled_components_1 = __importDefault(require("styled-components"));
34
+ const ChangeHandlingForm_1 = require("../ChangeHandlingForm");
35
+ const Row = styled_components_1.default.div `
36
+ display: flex;
37
+ `;
38
+ const AffiliationsTextField = (0, styled_components_1.default)(style_guide_1.TextField) `
39
+ border-radius: 0;
40
+ background: transparent;
41
+ margin-bottom: 4px;
42
+ border-radius: ${(props) => props.theme.grid.radius.default};
43
+ &[aria-invalid] {
44
+ background: ${(props) => props.theme.colors.background.warning};
45
+ }
46
+
47
+ &[aria-invalid]:focus {
48
+ background: transparent;
49
+ }
50
+ `;
51
+ const DepartmentTextField = (0, styled_components_1.default)(style_guide_1.TextArea) `
52
+ border-radius: 0;
53
+ background: transparent;
54
+ margin-bottom: 4px;
55
+ min-height: 60px;
56
+ border-radius: ${(props) => props.theme.grid.radius.default};
57
+ &[aria-invalid] {
58
+ background: ${(props) => props.theme.colors.background.warning};
59
+ }
60
+
61
+ &[aria-invalid]:focus {
62
+ background: transparent;
63
+ }
64
+ `;
65
+ const FormLabel = styled_components_1.default.legend `
66
+ &:not(:first-child) {
67
+ margin-top: 24px;
68
+ }
69
+ margin-bottom: 12px;
70
+ font: ${(props) => props.theme.font.weight.normal}
71
+ ${(props) => props.theme.font.size.xlarge} /
72
+ ${(props) => props.theme.font.lineHeight.large}
73
+ ${(props) => props.theme.font.family.sans};
74
+ letter-spacing: -0.4px;
75
+ color: ${(props) => props.theme.colors.text.secondary};
76
+ `;
77
+ const MarginRightTextField = (0, styled_components_1.default)(AffiliationsTextField) `
78
+ margin-right: 4px;
79
+ `;
80
+ const AffiliationForm = ({ values, onSave, onChange, actionsRef, }) => {
81
+ if (actionsRef && !actionsRef.current) {
82
+ actionsRef.current = {
83
+ reset: () => {
84
+ var _a;
85
+ (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.resetForm();
86
+ },
87
+ };
88
+ }
89
+ const formRef = (0, react_1.useRef)(null);
90
+ return (react_1.default.createElement(formik_1.Formik, { initialValues: values, onSubmit: onSave, innerRef: formRef, enableReinitialize: true }, () => (react_1.default.createElement(ChangeHandlingForm_1.ChangeHandlingForm, { onChange: onChange },
91
+ react_1.default.createElement(FormLabel, null, "Institution*"),
92
+ react_1.default.createElement(Row, null,
93
+ react_1.default.createElement(formik_1.Field, { name: "institution" }, (props) => (react_1.default.createElement(AffiliationsTextField, Object.assign({ id: "institution", placeholder: "Institution Name" }, props.field))))),
94
+ react_1.default.createElement(FormLabel, null, "Details"),
95
+ react_1.default.createElement(Row, null,
96
+ react_1.default.createElement(formik_1.Field, { name: "department" }, (props) => (react_1.default.createElement(DepartmentTextField, Object.assign({ id: "department", placeholder: "Department" }, props.field))))),
97
+ react_1.default.createElement(Row, null,
98
+ react_1.default.createElement(formik_1.Field, { name: "addressLine1" }, (props) => (react_1.default.createElement(AffiliationsTextField, Object.assign({ id: "addressLine1", placeholder: "Street Address" }, props.field))))),
99
+ react_1.default.createElement(Row, null,
100
+ react_1.default.createElement(formik_1.Field, { name: "city" }, (props) => (react_1.default.createElement(MarginRightTextField, Object.assign({ id: "city", placeholder: "City" }, props.field)))),
101
+ react_1.default.createElement(formik_1.Field, { name: "county" }, (props) => (react_1.default.createElement(AffiliationsTextField, Object.assign({ id: "county", placeholder: "State / Province" }, props.field))))),
102
+ react_1.default.createElement(Row, null,
103
+ react_1.default.createElement(formik_1.Field, { name: "postCode" }, (props) => (react_1.default.createElement(MarginRightTextField, Object.assign({ id: "postCode", placeholder: "Postal Code" }, props.field)))),
104
+ react_1.default.createElement(formik_1.Field, { name: "country" }, ({ field }) => (react_1.default.createElement(AffiliationsTextField, Object.assign({ id: "country", placeholder: "Country" }, field)))))))));
105
+ };
106
+ exports.AffiliationForm = AffiliationForm;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.AffiliationItem = void 0;
30
+ const style_guide_1 = require("@manuscripts/style-guide");
31
+ const react_1 = __importStar(require("react"));
32
+ const styled_components_1 = __importDefault(require("styled-components"));
33
+ const AffiliationContainer = styled_components_1.default.div `
34
+ padding: ${(props) => props.theme.grid.unit * 2}px 0
35
+ ${(props) => props.theme.grid.unit * 2}px;
36
+ display: flex;
37
+ align-items: center;
38
+ transition: background-color 0.25s;
39
+ border: 1px solid transparent;
40
+ border-left: 0;
41
+ border-right: 0;
42
+ cursor: pointer;
43
+ &:hover,
44
+ &.active {
45
+ background: ${(props) => props.theme.colors.background.fifth};
46
+ }
47
+
48
+ &.active {
49
+ border-color: ${(props) => props.theme.colors.border.primary};
50
+ }
51
+ `;
52
+ const AffiliationName = styled_components_1.default.div `
53
+ margin-left: 12px;
54
+ flex: 1;
55
+ text-overflow: ellipsis;
56
+ white-space: nowrap;
57
+ overflow: hidden;
58
+ width: 250px;
59
+ `;
60
+ const AffiliationDetails = styled_components_1.default.div `
61
+ margin-left: 12px;
62
+ flex: 1;
63
+ font-size: 12px;
64
+ font-style: normal;
65
+ font-weight: 400;
66
+ line-height: 16px;
67
+ margin-top: 2px;
68
+ color: ${(props) => props.theme.colors.text.secondary};
69
+ `;
70
+ const AffiliationBox = styled_components_1.default.div `
71
+ display: flex;
72
+ flex-direction: column;
73
+ margin-left: 4px;
74
+ `;
75
+ const RemoveButton = styled_components_1.default.div `
76
+ display: flex;
77
+ align-items: center;
78
+ margin-right: 8px;
79
+ svg {
80
+ cursor: pointer;
81
+ }
82
+ .icon_element {
83
+ fill: #6e6e6e;
84
+ }
85
+ `;
86
+ const AffiliationItem = ({ affiliation, isSelected, onClick, onDelete, showSuccessIcon, }) => {
87
+ var _a;
88
+ const ref = (0, react_1.useRef)(null);
89
+ if (isSelected) {
90
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
91
+ behavior: 'smooth',
92
+ block: 'nearest',
93
+ });
94
+ }
95
+ return (react_1.default.createElement(AffiliationContainer, { onClick: onClick, className: isSelected ? 'active' : '', ref: ref },
96
+ react_1.default.createElement(style_guide_1.AffiliationIcon, { opacity: showSuccessIcon ? 0.05 : 1, style: { minWidth: 24, minHeight: 24 } }),
97
+ react_1.default.createElement(AffiliationBox, null,
98
+ react_1.default.createElement(AffiliationName, null, affiliation.institution),
99
+ react_1.default.createElement(AffiliationDetails, null,
100
+ affiliation.city && (react_1.default.createElement(react_1.default.Fragment, null,
101
+ affiliation.city,
102
+ affiliation.county || affiliation.country ? ', ' : '')),
103
+ affiliation.county && (react_1.default.createElement(react_1.default.Fragment, null,
104
+ affiliation.county,
105
+ affiliation.country ? ', ' : '')),
106
+ affiliation.country && react_1.default.createElement(react_1.default.Fragment, null, affiliation.country))),
107
+ showSuccessIcon && (react_1.default.createElement(style_guide_1.CrclTickAnimation, { size: 36, style: { position: 'absolute', left: '10px' } })),
108
+ isSelected && (react_1.default.createElement(RemoveButton, { onClick: () => onDelete(), "data-tooltip-id": 'delete-button-tooltip' },
109
+ react_1.default.createElement(style_guide_1.DeleteIcon, { fill: '#6E6E6E' }),
110
+ react_1.default.createElement(style_guide_1.Tooltip, { id: 'delete-button-tooltip', place: "bottom" }, 'Delete')))));
111
+ };
112
+ exports.AffiliationItem = AffiliationItem;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.AffiliationList = void 0;
22
+ const react_1 = __importDefault(require("react"));
23
+ const styled_components_1 = __importDefault(require("styled-components"));
24
+ const AffiliationItem_1 = require("./AffiliationItem");
25
+ const AffiliationListContainer = styled_components_1.default.div `
26
+ flex: 1;
27
+ overflow-y: visible;
28
+ margin-left: 16px;
29
+ `;
30
+ const AffiliationListTitle = styled_components_1.default.h2 `
31
+ color: #6e6e6e;
32
+ font-size: 18px;
33
+ font-weight: 400;
34
+ line-height: 24px;
35
+ margin-left: 14px;
36
+ margin-top: 20px;
37
+ `;
38
+ const AffiliationList = ({ affiliation, affiliations, onSelect, onDelete, lastSavedAffiliationId, }) => {
39
+ return (react_1.default.createElement(react_1.default.Fragment, null,
40
+ react_1.default.createElement(AffiliationListTitle, null, "Existing Affiliations"),
41
+ react_1.default.createElement(AffiliationListContainer, { "data-cy": "affiliation-list" }, affiliations.map((a) => {
42
+ return (react_1.default.createElement(AffiliationItem_1.AffiliationItem, { key: a.id, affiliation: a, isSelected: a.id === (affiliation === null || affiliation === void 0 ? void 0 : affiliation.id), onClick: () => {
43
+ return onSelect(a);
44
+ }, onDelete: () => onDelete(), showSuccessIcon: lastSavedAffiliationId === a.id }));
45
+ }))));
46
+ };
47
+ exports.AffiliationList = AffiliationList;