@manuscripts/body-editor 3.0.2 → 3.0.3-LEAN-4579.1

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 (39) hide show
  1. package/dist/cjs/components/affiliations/AffiliationsModal.js +79 -126
  2. package/dist/cjs/components/authors/AffiliationDrawer.js +24 -0
  3. package/dist/cjs/components/authors/AuthorDetailsForm.js +11 -9
  4. package/dist/cjs/components/authors/AuthorsModal.js +121 -204
  5. package/dist/cjs/components/authors/CreditDrawer.js +37 -0
  6. package/dist/cjs/components/authors/useManageAffiliations.js +41 -0
  7. package/dist/cjs/components/authors/useManageCredit.js +43 -0
  8. package/dist/cjs/components/form/FormFooter.js +2 -0
  9. package/dist/cjs/components/form/ModalFormActions.js +4 -4
  10. package/dist/cjs/components/modal-drawer/GenericDrawer.js +16 -0
  11. package/dist/cjs/components/modal-drawer/GenericDrawerGroup.js +75 -0
  12. package/dist/cjs/lib/normalize.js +49 -0
  13. package/dist/cjs/versions.js +1 -1
  14. package/dist/es/components/affiliations/AffiliationsModal.js +80 -127
  15. package/dist/es/components/authors/AffiliationDrawer.js +17 -0
  16. package/dist/es/components/authors/AuthorDetailsForm.js +9 -7
  17. package/dist/es/components/authors/AuthorsModal.js +123 -206
  18. package/dist/es/components/authors/CreditDrawer.js +30 -0
  19. package/dist/es/components/authors/useManageAffiliations.js +37 -0
  20. package/dist/es/components/authors/useManageCredit.js +39 -0
  21. package/dist/es/components/form/FormFooter.js +2 -0
  22. package/dist/es/components/form/ModalFormActions.js +4 -4
  23. package/dist/es/components/modal-drawer/GenericDrawer.js +9 -0
  24. package/dist/es/components/modal-drawer/GenericDrawerGroup.js +68 -0
  25. package/dist/es/lib/normalize.js +44 -0
  26. package/dist/es/versions.js +1 -1
  27. package/dist/types/components/authors/AffiliationDrawer.d.ts +12 -0
  28. package/dist/types/components/authors/AuthorDetailsForm.d.ts +4 -1
  29. package/dist/types/components/authors/AuthorsModal.d.ts +1 -2
  30. package/dist/types/components/authors/CreditDrawer.d.ts +14 -0
  31. package/dist/types/components/authors/useManageAffiliations.d.ts +18 -0
  32. package/dist/types/components/authors/useManageCredit.d.ts +13 -0
  33. package/dist/types/components/form/ModalFormActions.d.ts +2 -2
  34. package/dist/types/components/modal-drawer/GenericDrawer.d.ts +14 -0
  35. package/dist/types/components/modal-drawer/GenericDrawerGroup.d.ts +45 -0
  36. package/dist/types/lib/normalize.d.ts +25 -0
  37. package/dist/types/types.d.ts +1 -0
  38. package/dist/types/versions.d.ts +1 -1
  39. package/package.json +4 -4
@@ -0,0 +1,68 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { SelectedItemsBox } from '@manuscripts/style-guide';
17
+ import React from 'react';
18
+ import styled from 'styled-components';
19
+ export function DrawerGroup({ removeItem, selectedItems, onSelect, items, showDrawer, setShowDrawer, title, labelField, Drawer, cy, Icon, buttonText, }) {
20
+ return (React.createElement(React.Fragment, null,
21
+ React.createElement(DrawerSection, null,
22
+ React.createElement(DrawerSectionHeader, null,
23
+ React.createElement(DrawerSectionTitle, null, title),
24
+ React.createElement(AssignButton, { onClick: () => setShowDrawer(true), "data-cy": cy + 'assign-button' },
25
+ Icon,
26
+ buttonText)),
27
+ React.createElement(SelectedItemsBox, { "data-cy": cy + '-selected-items', items: selectedItems.map((i) => ({
28
+ id: String(i.id),
29
+ label: String(i[labelField] ?? ''),
30
+ })), onRemove: removeItem, placeholder: `No ${title}s assigned` })),
31
+ showDrawer && (React.createElement(Drawer, { items: items, selectedItems: selectedItems, title: title, onSelect: onSelect, onBack: () => setShowDrawer(false), width: "100%" }))));
32
+ }
33
+ const DrawerSectionTitle = styled.h3 `
34
+ margin: 0;
35
+ font-weight: ${(props) => props.theme.font.weight.normal};
36
+ font-size: ${(props) => props.theme.font.size.large};
37
+ font-family: ${(props) => props.theme.font.family.sans};
38
+ color: ${(props) => props.theme.colors.text.secondary};
39
+ `;
40
+ export const AssignButton = styled.button `
41
+ color: ${(props) => props.theme.colors.brand.default};
42
+ background: none;
43
+ border: none;
44
+ cursor: pointer;
45
+ padding: 0;
46
+ font: ${(props) => props.theme.font.weight.normal}
47
+ ${(props) => props.theme.font.size.normal}
48
+ ${(props) => props.theme.font.family.sans};
49
+ display: flex;
50
+ align-items: center;
51
+ gap: 4px;
52
+ margin-top: ${(props) => props.theme.grid.unit * 2}px;
53
+ &:hover {
54
+ opacity: 0.8;
55
+ }
56
+ `;
57
+ export const DrawerSectionHeader = styled.div `
58
+ display: flex;
59
+ justify-content: space-between;
60
+ align-items: flex-start;
61
+ flex-direction: column;
62
+ margin-bottom: ${(props) => props.theme.grid.unit * 2}px;
63
+ `;
64
+ export const DrawerSection = styled.div `
65
+ margin-top: ${(props) => props.theme.grid.unit * 4}px;
66
+ padding-top: ${(props) => props.theme.grid.unit * 4}px;
67
+ border-top: 1px solid ${(props) => props.theme.colors.border.tertiary};
68
+ `;
@@ -0,0 +1,44 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { generateNodeID, schema } from '@manuscripts/transform';
17
+ export const normalizeAuthor = (author) => {
18
+ const basic = {
19
+ id: author.id,
20
+ role: author.role || '',
21
+ affiliations: (author.affiliations || []).sort(),
22
+ bibliographicName: author.bibliographicName,
23
+ email: author.email || '',
24
+ isCorresponding: author.isCorresponding || false,
25
+ ORCIDIdentifier: author.ORCIDIdentifier || '',
26
+ priority: author.priority || 0,
27
+ isJointContributor: author.isJointContributor || false,
28
+ userID: author.userID || '',
29
+ invitationID: author.invitationID || '',
30
+ footnote: author.footnote || [],
31
+ corresp: author.corresp || [],
32
+ prefix: author.prefix || '',
33
+ };
34
+ if (author.creditRoles && Array.isArray(author.creditRoles)) {
35
+ basic.creditRoles = author.creditRoles;
36
+ }
37
+ return basic;
38
+ };
39
+ export const checkID = (attrs, nodeType) => {
40
+ return {
41
+ ...attrs,
42
+ id: attrs.id || generateNodeID(schema.nodes[nodeType]),
43
+ };
44
+ };
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.0.2';
1
+ export const VERSION = '3.0.3-LEAN-4579.1';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -0,0 +1,12 @@
1
+ import { DrawerProps } from '@manuscripts/style-guide';
2
+ import React from 'react';
3
+ import { AffiliationAttrs } from '../../lib/authors';
4
+ interface AffiliationsDrawerProps {
5
+ items: AffiliationAttrs[];
6
+ selectedItems: {
7
+ id: string;
8
+ }[];
9
+ onSelect: (id: string) => void;
10
+ }
11
+ export declare const AffiliationsDrawer: React.FC<AffiliationsDrawerProps & Omit<DrawerProps, 'children'>>;
12
+ export {};
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2019 Atypon Systems LLC
2
+ * © 2025 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,10 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { CreditRole } from '@manuscripts/transform';
16
17
  import React, { MutableRefObject } from 'react';
17
18
  import { ContributorAttrs } from '../../lib/authors';
18
19
  export declare const LabelText: import("styled-components").StyledComponent<"div", any, {}, never>;
19
20
  export declare const Fieldset: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
21
+ export declare const CheckboxContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
20
22
  export interface FormActions {
21
23
  reset: () => void;
22
24
  }
@@ -28,6 +30,7 @@ interface AuthorDetailsFormProps {
28
30
  actionsRef?: MutableRefObject<FormActions | undefined>;
29
31
  isEmailRequired?: boolean;
30
32
  selectedAffiliations?: string[];
33
+ selectedCreditRoles: CreditRole[];
31
34
  }
32
35
  export declare const AuthorDetailsForm: React.FC<AuthorDetailsFormProps>;
33
36
  export {};
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2024 Atypon Systems LLC
2
+ * © 2025 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
16
16
  import React from 'react';
17
17
  import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
18
18
  export declare const authorsReducer: (state: ContributorAttrs[], action: import("../../lib/array-reducer").Action<ContributorAttrs>) => ContributorAttrs[];
19
- export declare const affiliationsReducer: (state: AffiliationAttrs[], action: import("../../lib/array-reducer").Action<AffiliationAttrs>) => AffiliationAttrs[];
20
19
  export interface AuthorsModalProps {
21
20
  author?: ContributorAttrs;
22
21
  authors: ContributorAttrs[];
@@ -0,0 +1,14 @@
1
+ import { DrawerProps } from '@manuscripts/style-guide';
2
+ import React from 'react';
3
+ interface CreditDrawerProps {
4
+ items: {
5
+ id: string;
6
+ vocabTerm: string;
7
+ }[];
8
+ selectedItems: {
9
+ id: string;
10
+ }[];
11
+ onSelect: (id: string) => void;
12
+ }
13
+ export declare const CreditDrawer: React.FC<CreditDrawerProps & Omit<DrawerProps, 'children'>>;
14
+ export {};
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { AffiliationAttrs, ContributorAttrs } from '../../lib/authors';
3
+ export declare const affiliationsReducer: (state: AffiliationAttrs[], action: import("../../lib/array-reducer").Action<AffiliationAttrs>) => AffiliationAttrs[];
4
+ export declare const useManageAffiliations: (selection: ContributorAttrs | undefined, $affiliations: AffiliationAttrs[]) => {
5
+ showAffiliationDrawer: boolean;
6
+ setShowAffiliationDrawer: import("react").Dispatch<import("react").SetStateAction<boolean>>;
7
+ selectedAffiliations: {
8
+ id: string;
9
+ institution: string;
10
+ }[];
11
+ setSelectedAffiliations: import("react").Dispatch<import("react").SetStateAction<{
12
+ id: string;
13
+ institution: string;
14
+ }[]>>;
15
+ removeAffiliation: (affId: string) => void;
16
+ selectAffiliation: (affiliationId: string) => void;
17
+ affiliations: AffiliationAttrs[];
18
+ };
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { CreditRole, CreditVocabTerm } from '@manuscripts/transform';
3
+ import { ContributorAttrs } from '../../lib/authors';
4
+ export declare const useManageCredit: (selection: ContributorAttrs | undefined) => {
5
+ removeCreditRole: (role: string) => void;
6
+ selectCreditRole: (role: string) => void;
7
+ selectedCreditRoles: CreditRole[];
8
+ setSelectedCreditRoles: import("react").Dispatch<import("react").SetStateAction<CreditRole[]>>;
9
+ vocabTermItems: {
10
+ vocabTerm: CreditVocabTerm;
11
+ id: CreditVocabTerm;
12
+ }[];
13
+ };
@@ -3,8 +3,8 @@ export interface FormActionsProps {
3
3
  type: string;
4
4
  form: string;
5
5
  onDelete: () => void;
6
- showDeleteDialog: boolean;
7
- handleShowDeleteDialog: () => void;
6
+ showingDeleteDialog: boolean;
7
+ showDeleteDialog: () => void;
8
8
  newEntity: boolean;
9
9
  isDisableSave: boolean;
10
10
  }
@@ -0,0 +1,14 @@
1
+ import { DrawerProps } from '@manuscripts/style-guide';
2
+ import React from 'react';
3
+ interface GenericDrawerProps {
4
+ items: {
5
+ id: string;
6
+ label: string;
7
+ }[];
8
+ selectedItems: {
9
+ id: string;
10
+ }[];
11
+ onSelect: (id: string) => void;
12
+ }
13
+ export declare const GenericDrawer: React.FC<GenericDrawerProps & Omit<DrawerProps, 'children'>>;
14
+ export {};
@@ -0,0 +1,45 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { DrawerProps } from '@manuscripts/style-guide';
17
+ import React from 'react';
18
+ import { PartialExcept } from '../../types';
19
+ type Base = {
20
+ id: string;
21
+ } & Record<string, any>;
22
+ interface DrawerGroupProps<T extends Base> {
23
+ removeItem: (id: string) => void;
24
+ selectedItems: PartialExcept<T, 'id'>[];
25
+ items: T[];
26
+ showDrawer: boolean;
27
+ setShowDrawer: (on: boolean) => void;
28
+ onSelect: (id: string) => void;
29
+ title: string;
30
+ labelField: keyof T;
31
+ Drawer: React.ComponentType<EmbeddedDrawerProps<T> & Omit<DrawerProps, 'children'>>;
32
+ cy: string;
33
+ buttonText: string;
34
+ Icon?: React.ReactNode;
35
+ }
36
+ interface EmbeddedDrawerProps<T extends Base> {
37
+ items: T[];
38
+ selectedItems: DrawerGroupProps<T>['selectedItems'];
39
+ onSelect: (id: string) => void;
40
+ }
41
+ export declare function DrawerGroup<T extends Base>({ removeItem, selectedItems, onSelect, items, showDrawer, setShowDrawer, title, labelField, Drawer, cy, Icon, buttonText, }: DrawerGroupProps<T>): React.JSX.Element;
42
+ export declare const AssignButton: import("styled-components").StyledComponent<"button", any, {}, never>;
43
+ export declare const DrawerSectionHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
44
+ export declare const DrawerSection: import("styled-components").StyledComponent<"div", any, {}, never>;
45
+ export {};
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Nodes } from '@manuscripts/transform';
17
+ import { ContributorAttrs } from './authors';
18
+ export declare const normalizeAuthor: (author: ContributorAttrs) => ContributorAttrs;
19
+ type WithID = {
20
+ id: string | undefined;
21
+ };
22
+ export declare const checkID: <T extends WithID>(attrs: T, nodeType: Nodes) => T & {
23
+ id: string;
24
+ };
25
+ export {};
@@ -37,3 +37,4 @@ export type WidgetDecoration = Decoration & {
37
37
  spec: Decoration['spec'];
38
38
  };
39
39
  };
40
+ export type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.0.2";
1
+ export declare const VERSION = "3.0.3-LEAN-4579.1";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/body-editor",
3
3
  "description": "Prosemirror components for editing and viewing manuscripts",
4
- "version": "3.0.2",
4
+ "version": "3.0.3-LEAN-4579.1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -37,9 +37,9 @@
37
37
  "@citation-js/plugin-pubmed": "0.3.0",
38
38
  "@citation-js/plugin-ris": "0.7.18",
39
39
  "@manuscripts/json-schema": "2.2.12",
40
- "@manuscripts/style-guide": "3.0.1",
40
+ "@manuscripts/style-guide": "3.0.2-LEAN-4579.0",
41
41
  "@manuscripts/track-changes-plugin": "2.0.1",
42
- "@manuscripts/transform": "4.0.0",
42
+ "@manuscripts/transform": "4.0.1-LEAN-4579.2",
43
43
  "@popperjs/core": "2.11.8",
44
44
  "citeproc": "2.4.63",
45
45
  "codemirror": "5.65.19",
@@ -120,4 +120,4 @@
120
120
  "engines": {
121
121
  "node": ">=20.16.0"
122
122
  }
123
- }
123
+ }