@manuscripts/style-guide 1.7.0 → 1.7.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.
@@ -63,7 +63,7 @@ exports.CommentBody = react_1.default.memo(({ comment, saveComment, deleteCommen
63
63
  (comment.contents === values.contents ||
64
64
  !values.contents.replace(/<[^>]+>/g, '').length)), type: "submit" }, "Save"))))))) : (react_1.default.createElement("div", null,
65
65
  react_1.default.createElement(CommentContent, { onClick: () => scrollIntoHighlight && scrollIntoHighlight(comment) },
66
- react_1.default.createElement(StyledCommentViewer, null, comment.contents)),
66
+ react_1.default.createElement(StyledCommentViewer, { "data-cy": "note-text" }, comment.contents)),
67
67
  !isReply && (react_1.default.createElement(CommentFooter, null,
68
68
  react_1.default.createElement("span", null,
69
69
  react_1.default.createElement(ActionButton, { hidden: !isProdNote, "data-tip": true, "data-for": `reply-${comment._id}`, onClick: () => handleCreateReply(comment._id), "aria-label": 'reply', className: "reply-button note-actions" },
@@ -51,5 +51,5 @@ exports.CommentTarget = react_1.default.memo(({ isSelected, children }) => {
51
51
  });
52
52
  }
53
53
  });
54
- return react_1.default.createElement("div", { ref: threadRef }, children);
54
+ return (react_1.default.createElement("div", { "data-cy": "comment-target", ref: threadRef }, children));
55
55
  });
@@ -84,8 +84,8 @@ const CommentWrapper = ({ createKeyword, comment, can, currentUserId, getCollabo
84
84
  }
85
85
  }, [handleRequestSelect]);
86
86
  const isOwnComment = (0, react_1.useMemo)(() => isOwn(comment, currentUserId), [comment, currentUserId]);
87
- return (react_1.default.createElement(Note, { ref: threadRef, isSelected: isSelected },
88
- react_1.default.createElement(NoteHeader, null,
87
+ return (react_1.default.createElement(Note, { "data-cy": "note", ref: threadRef, isSelected: isSelected },
88
+ react_1.default.createElement(NoteHeader, { "data-cy": "note-header" },
89
89
  react_1.default.createElement(NoteTitle, { type: "button", onMouseDown: onTitleMouseDown, onKeyDown: onTitleKeyDown }, comment.contributions && (react_1.default.createElement(CommentUser_1.CommentUser, { contributions: comment.contributions, getCollaboratorById: getCollaborator, displayName: comment.displayName, createdAt: (0, comments_1.isSavedComment)(comment) ? comment.createdAt * 1000 : undefined }))),
90
90
  react_1.default.createElement(CommentActions_1.CommentActions, { id: comment._id, isOwnComment: isOwnComment, can: can, target: comment.target, isResolved: comment.resolved, handleSetResolved: handleSetResolved, deleteComment: deleteComment, setIsEditing: setIsEditing, isProdNote: isProdNote })),
91
91
  children,
@@ -65,9 +65,9 @@ const FileActions = ({ sectionType, handleDownload, handleReplace, handleDetach,
65
65
  }
66
66
  };
67
67
  return show ? (react_1.default.createElement(Dropdown_1.DropdownContainer, { ref: wrapperRef },
68
- react_1.default.createElement(exports.ActionsIcon, { onClick: toggleOpen, type: "button", className: "show-on-hover", "aria-label": "Actions", "aria-pressed": isOpen },
68
+ react_1.default.createElement(exports.ActionsIcon, { onClick: toggleOpen, type: "button", className: "show-on-hover", "data-cy": "file-actions", "aria-label": "Actions", "aria-pressed": isOpen },
69
69
  react_1.default.createElement(dots_icon_1.default, null)),
70
- isOpen && (react_1.default.createElement(exports.FileActionDropdownList, { direction: "right", className: className, width: 192, top: 5, onClick: toggleOpen },
70
+ isOpen && (react_1.default.createElement(exports.FileActionDropdownList, { "data-cy": "file-actions-dropdown", direction: "right", className: className, width: 192, top: 5, onClick: toggleOpen },
71
71
  showDownload && (react_1.default.createElement(exports.FileAction, { onClick: handleDownload }, "Download")),
72
72
  showReplace && (react_1.default.createElement(react_1.default.Fragment, null,
73
73
  react_1.default.createElement(exports.FileAction, { onClick: openFileDialog }, "Replace"),
@@ -50,11 +50,11 @@ const FileManager = ({ files, fileManagement, modelMap, saveModel, deleteModel,
50
50
  react_1.default.createElement(Inspector_1.InspectorTab, { "data-for": "other", "data-tip": true }, "Other files"),
51
51
  react_1.default.createElement(Tooltip_1.Tooltip, { id: "other", place: "bottom", offset: { bottom: -11 }, effect: "solid", className: "tooltip" }, "Files excluded from the final submission.")),
52
52
  react_1.default.createElement(Inspector_1.InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
53
- react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
54
- react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { "data-cy": "inline-files", elements: inlineFiles, isEditor: enableDragAndDrop })),
55
- react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
56
- react_1.default.createElement(SupplementsSection_1.SupplementsSection, { "data-cy": "supplements-files", supplements: supplements })),
57
- react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
58
- react_1.default.createElement(OtherFilesSection_1.OtherFilesSection, { "data-cy": "other-files", files: otherFiles }))))))));
53
+ react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "inline" },
54
+ react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { elements: inlineFiles, isEditor: enableDragAndDrop })),
55
+ react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "supplements" },
56
+ react_1.default.createElement(SupplementsSection_1.SupplementsSection, { supplements: supplements })),
57
+ react_1.default.createElement(Inspector_1.InspectorTabPanel, { "data-cy": "other" },
58
+ react_1.default.createElement(OtherFilesSection_1.OtherFilesSection, { files: otherFiles }))))))));
59
59
  };
60
60
  exports.FileManager = FileManager;
@@ -10,7 +10,7 @@ const FileTypeIcon_1 = require("./FileTypeIcon");
10
10
  const FileName = ({ file }) => {
11
11
  return (react_1.default.createElement(react_1.default.Fragment, null,
12
12
  react_1.default.createElement(FileTypeIcon_1.FileTypeIcon, { file: file }),
13
- react_1.default.createElement(exports.FileNameText, null, file.name)));
13
+ react_1.default.createElement(exports.FileNameText, { "data-cy": "filename" }, file.name)));
14
14
  };
15
15
  exports.FileName = FileName;
16
16
  exports.FileNameText = styled_components_1.default.div `
@@ -84,7 +84,7 @@ const InlineFilesSection = ({ elements, isEditor }) => {
84
84
  };
85
85
  exports.InlineFilesSection = InlineFilesSection;
86
86
  const ElementFile = ({ file, handleReplace, handleDownload, handleDetach }) => {
87
- return (react_1.default.createElement(ModelFileContainer, null,
87
+ return (react_1.default.createElement(ModelFileContainer, { "data-cy": "file-container" },
88
88
  react_1.default.createElement(FileName_1.FileName, { file: file }),
89
89
  react_1.default.createElement(FileCreatedDate_1.FileCreatedDate, { file: file, className: "show-on-hover" }),
90
90
  react_1.default.createElement(FileActions_1.FileActions, { "data-cy": "file-actions", sectionType: util_1.FileSectionType.Inline, handleDownload: file.id ? handleDownload : undefined, handleDetach: file.id ? handleDetach : undefined, handleReplace: handleReplace })));
@@ -91,7 +91,7 @@ const OtherFile = ({ file, handleDownload, handleMoveToSupplements }) => {
91
91
  (0, react_1.useEffect)(() => {
92
92
  preview((0, react_dnd_html5_backend_1.getEmptyImage)());
93
93
  }, [preview]);
94
- return (react_1.default.createElement(FileContainer_1.FileContainer, { key: file.id, ref: drag, className: isDragging ? 'dragging' : '' },
94
+ return (react_1.default.createElement(FileContainer_1.FileContainer, { key: file.id, "data-cy": "file-container", ref: drag, className: isDragging ? 'dragging' : '' },
95
95
  react_1.default.createElement(FileName_1.FileName, { file: file }),
96
96
  react_1.default.createElement(FileCreatedDate_1.FileCreatedDate, { file: file, className: "show-on-hover" }),
97
97
  react_1.default.createElement(FileActions_1.FileActions, { sectionType: util_1.FileSectionType.OtherFile, handleDownload: handleDownload, move: {
@@ -106,10 +106,10 @@ const SupplementFile = ({ file, handleDownload, handleReplace, handleDetach }) =
106
106
  (0, react_1.useEffect)(() => {
107
107
  preview((0, react_dnd_html5_backend_1.getEmptyImage)());
108
108
  }, [preview]);
109
- return (react_1.default.createElement(FileContainer_1.FileContainer, { key: file.id, ref: drag, className: isDragging ? 'dragging' : '' },
109
+ return (react_1.default.createElement(FileContainer_1.FileContainer, { "data-cy": "file-container", key: file.id, ref: drag, className: isDragging ? 'dragging' : '' },
110
110
  react_1.default.createElement(FileName_1.FileName, { file: file }),
111
111
  react_1.default.createElement(FileCreatedDate_1.FileCreatedDate, { file: file, className: "show-on-hover" }),
112
- react_1.default.createElement(FileActions_1.FileActions, { sectionType: util_1.FileSectionType.Supplements, handleDownload: file.id ? handleDownload : undefined, handleReplace: handleReplace, move: file.id
112
+ react_1.default.createElement(FileActions_1.FileActions, { "data-cy": "file-actions", sectionType: util_1.FileSectionType.Supplements, handleDownload: file.id ? handleDownload : undefined, handleReplace: handleReplace, move: file.id
113
113
  ? {
114
114
  sectionType: util_1.FileSectionType.OtherFile,
115
115
  handler: handleDetach,
@@ -34,7 +34,7 @@ export const CommentBody = React.memo(({ comment, saveComment, deleteComment, is
34
34
  (comment.contents === values.contents ||
35
35
  !values.contents.replace(/<[^>]+>/g, '').length)), type: "submit" }, "Save"))))))) : (React.createElement("div", null,
36
36
  React.createElement(CommentContent, { onClick: () => scrollIntoHighlight && scrollIntoHighlight(comment) },
37
- React.createElement(StyledCommentViewer, null, comment.contents)),
37
+ React.createElement(StyledCommentViewer, { "data-cy": "note-text" }, comment.contents)),
38
38
  !isReply && (React.createElement(CommentFooter, null,
39
39
  React.createElement("span", null,
40
40
  React.createElement(ActionButton, { hidden: !isProdNote, "data-tip": true, "data-for": `reply-${comment._id}`, onClick: () => handleCreateReply(comment._id), "aria-label": 'reply', className: "reply-button note-actions" },
@@ -25,5 +25,5 @@ export const CommentTarget = React.memo(({ isSelected, children }) => {
25
25
  });
26
26
  }
27
27
  });
28
- return React.createElement("div", { ref: threadRef }, children);
28
+ return (React.createElement("div", { "data-cy": "comment-target", ref: threadRef }, children));
29
29
  });
@@ -55,8 +55,8 @@ export const CommentWrapper = ({ createKeyword, comment, can, currentUserId, get
55
55
  }
56
56
  }, [handleRequestSelect]);
57
57
  const isOwnComment = useMemo(() => isOwn(comment, currentUserId), [comment, currentUserId]);
58
- return (React.createElement(Note, { ref: threadRef, isSelected: isSelected },
59
- React.createElement(NoteHeader, null,
58
+ return (React.createElement(Note, { "data-cy": "note", ref: threadRef, isSelected: isSelected },
59
+ React.createElement(NoteHeader, { "data-cy": "note-header" },
60
60
  React.createElement(NoteTitle, { type: "button", onMouseDown: onTitleMouseDown, onKeyDown: onTitleKeyDown }, comment.contributions && (React.createElement(CommentUser, { contributions: comment.contributions, getCollaboratorById: getCollaborator, displayName: comment.displayName, createdAt: isSavedComment(comment) ? comment.createdAt * 1000 : undefined }))),
61
61
  React.createElement(CommentActions, { id: comment._id, isOwnComment: isOwnComment, can: can, target: comment.target, isResolved: comment.resolved, handleSetResolved: handleSetResolved, deleteComment: deleteComment, setIsEditing: setIsEditing, isProdNote: isProdNote })),
62
62
  children,
@@ -36,9 +36,9 @@ export const FileActions = ({ sectionType, handleDownload, handleReplace, handle
36
36
  }
37
37
  };
38
38
  return show ? (React.createElement(DropdownContainer, { ref: wrapperRef },
39
- React.createElement(ActionsIcon, { onClick: toggleOpen, type: "button", className: "show-on-hover", "aria-label": "Actions", "aria-pressed": isOpen },
39
+ React.createElement(ActionsIcon, { onClick: toggleOpen, type: "button", className: "show-on-hover", "data-cy": "file-actions", "aria-label": "Actions", "aria-pressed": isOpen },
40
40
  React.createElement(DotsIcon, null)),
41
- isOpen && (React.createElement(FileActionDropdownList, { direction: "right", className: className, width: 192, top: 5, onClick: toggleOpen },
41
+ isOpen && (React.createElement(FileActionDropdownList, { "data-cy": "file-actions-dropdown", direction: "right", className: className, width: 192, top: 5, onClick: toggleOpen },
42
42
  showDownload && (React.createElement(FileAction, { onClick: handleDownload }, "Download")),
43
43
  showReplace && (React.createElement(React.Fragment, null,
44
44
  React.createElement(FileAction, { onClick: openFileDialog }, "Replace"),
@@ -24,10 +24,10 @@ export const FileManager = ({ files, fileManagement, modelMap, saveModel, delete
24
24
  React.createElement(InspectorTab, { "data-for": "other", "data-tip": true }, "Other files"),
25
25
  React.createElement(Tooltip, { id: "other", place: "bottom", offset: { bottom: -11 }, effect: "solid", className: "tooltip" }, "Files excluded from the final submission.")),
26
26
  React.createElement(InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
27
- React.createElement(InspectorTabPanel, null,
28
- React.createElement(InlineFilesSection, { "data-cy": "inline-files", elements: inlineFiles, isEditor: enableDragAndDrop })),
29
- React.createElement(InspectorTabPanel, null,
30
- React.createElement(SupplementsSection, { "data-cy": "supplements-files", supplements: supplements })),
31
- React.createElement(InspectorTabPanel, null,
32
- React.createElement(OtherFilesSection, { "data-cy": "other-files", files: otherFiles }))))))));
27
+ React.createElement(InspectorTabPanel, { "data-cy": "inline" },
28
+ React.createElement(InlineFilesSection, { elements: inlineFiles, isEditor: enableDragAndDrop })),
29
+ React.createElement(InspectorTabPanel, { "data-cy": "supplements" },
30
+ React.createElement(SupplementsSection, { supplements: supplements })),
31
+ React.createElement(InspectorTabPanel, { "data-cy": "other" },
32
+ React.createElement(OtherFilesSection, { files: otherFiles }))))))));
33
33
  };
@@ -4,7 +4,7 @@ import { FileTypeIcon } from './FileTypeIcon';
4
4
  export const FileName = ({ file }) => {
5
5
  return (React.createElement(React.Fragment, null,
6
6
  React.createElement(FileTypeIcon, { file: file }),
7
- React.createElement(FileNameText, null, file.name)));
7
+ React.createElement(FileNameText, { "data-cy": "filename" }, file.name)));
8
8
  };
9
9
  export const FileNameText = styled.div `
10
10
  font-family: ${(props) => props.theme.font.family.Lato};
@@ -54,7 +54,7 @@ export const InlineFilesSection = ({ elements, isEditor }) => {
54
54
  })));
55
55
  };
56
56
  const ElementFile = ({ file, handleReplace, handleDownload, handleDetach }) => {
57
- return (React.createElement(ModelFileContainer, null,
57
+ return (React.createElement(ModelFileContainer, { "data-cy": "file-container" },
58
58
  React.createElement(FileName, { file: file }),
59
59
  React.createElement(FileCreatedDate, { file: file, className: "show-on-hover" }),
60
60
  React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Inline, handleDownload: file.id ? handleDownload : undefined, handleDetach: file.id ? handleDetach : undefined, handleReplace: handleReplace })));
@@ -64,7 +64,7 @@ const OtherFile = ({ file, handleDownload, handleMoveToSupplements }) => {
64
64
  useEffect(() => {
65
65
  preview(getEmptyImage());
66
66
  }, [preview]);
67
- return (React.createElement(FileContainer, { key: file.id, ref: drag, className: isDragging ? 'dragging' : '' },
67
+ return (React.createElement(FileContainer, { key: file.id, "data-cy": "file-container", ref: drag, className: isDragging ? 'dragging' : '' },
68
68
  React.createElement(FileName, { file: file }),
69
69
  React.createElement(FileCreatedDate, { file: file, className: "show-on-hover" }),
70
70
  React.createElement(FileActions, { sectionType: FileSectionType.OtherFile, handleDownload: handleDownload, move: {
@@ -79,10 +79,10 @@ const SupplementFile = ({ file, handleDownload, handleReplace, handleDetach }) =
79
79
  useEffect(() => {
80
80
  preview(getEmptyImage());
81
81
  }, [preview]);
82
- return (React.createElement(FileContainer, { key: file.id, ref: drag, className: isDragging ? 'dragging' : '' },
82
+ return (React.createElement(FileContainer, { "data-cy": "file-container", key: file.id, ref: drag, className: isDragging ? 'dragging' : '' },
83
83
  React.createElement(FileName, { file: file }),
84
84
  React.createElement(FileCreatedDate, { file: file, className: "show-on-hover" }),
85
- React.createElement(FileActions, { sectionType: FileSectionType.Supplements, handleDownload: file.id ? handleDownload : undefined, handleReplace: handleReplace, move: file.id
85
+ React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Supplements, handleDownload: file.id ? handleDownload : undefined, handleReplace: handleReplace, move: file.id
86
86
  ? {
87
87
  sectionType: FileSectionType.OtherFile,
88
88
  handler: handleDetach,
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.7.0",
4
+ "version": "1.7.1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",