@manuscripts/style-guide 1.6.1 → 1.6.2

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.
@@ -76,7 +76,7 @@ const FileActions = ({ sectionType, handleDownload, handleReplace, handleDetach,
76
76
  showMove && (react_1.default.createElement(exports.FileAction, { onClick: () => setMoveDialogOpen(true) },
77
77
  "Move to ",
78
78
  move.sectionType)))),
79
- showMove && (react_1.default.createElement(MoveFileConfirmationDialog, { isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })))) : (react_1.default.createElement(react_1.default.Fragment, null));
79
+ showMove && (react_1.default.createElement(MoveFileConfirmationDialog, { "data-cy": "file-move-confirm-dialog", isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })))) : (react_1.default.createElement(react_1.default.Fragment, null));
80
80
  };
81
81
  exports.FileActions = FileActions;
82
82
  const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove }) => {
@@ -41,7 +41,7 @@ const FileManager = ({ files, fileManagement, modelMap, saveModel, deleteModel,
41
41
  react_1.default.createElement(DragLayer_1.DragLayer, null),
42
42
  react_1.default.createElement(exports.PermissionsContext.Provider, { value: can },
43
43
  react_1.default.createElement(InspectorSection_1.InspectorSection, { title: 'Files', contentStyles: { margin: '24px 16px' } },
44
- react_1.default.createElement(Inspector_1.InspectorTabs, { defaultIndex: 0, style: { overflow: 'visible' } },
44
+ react_1.default.createElement(Inspector_1.InspectorTabs, { defaultIndex: 0, "data-cy": "files-tabs", style: { overflow: 'visible' } },
45
45
  react_1.default.createElement(Inspector_1.InspectorTabList, null,
46
46
  react_1.default.createElement(Inspector_1.InspectorTab, { "data-for": "inline", "data-tip": true }, "Inline files"),
47
47
  react_1.default.createElement(Tooltip_1.Tooltip, { id: "inline", place: "bottom", offset: { bottom: -11 }, effect: "solid", className: "tooltip" }, "Files that can be found inline in the manuscript."),
@@ -51,10 +51,10 @@ const FileManager = ({ files, fileManagement, modelMap, saveModel, deleteModel,
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
53
  react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
54
- react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { elements: inlineFiles, isEditor: enableDragAndDrop })),
54
+ react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { "data-cy": "inline-files", elements: inlineFiles, isEditor: enableDragAndDrop })),
55
55
  react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
56
- react_1.default.createElement(SupplementsSection_1.SupplementsSection, { supplements: supplements })),
56
+ react_1.default.createElement(SupplementsSection_1.SupplementsSection, { "data-cy": "supplements-files", supplements: supplements })),
57
57
  react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
58
- react_1.default.createElement(OtherFilesSection_1.OtherFilesSection, { files: otherFiles }))))))));
58
+ react_1.default.createElement(OtherFilesSection_1.OtherFilesSection, { "data-cy": "other-files", files: otherFiles }))))))));
59
59
  };
60
60
  exports.FileManager = FileManager;
@@ -67,7 +67,7 @@ const FileUploader = ({ handler }) => {
67
67
  }),
68
68
  });
69
69
  const isActive = canDrop && isOver;
70
- return (react_1.default.createElement(Container, { ref: dropRef, active: isActive, onClick: openFileDialog },
70
+ return (react_1.default.createElement(Container, { ref: dropRef, "data-cy": "file-uploader", active: isActive, onClick: openFileDialog },
71
71
  react_1.default.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: (e) => handleChange(e), value: '' }),
72
72
  "Drag or click to upload a new file"));
73
73
  };
@@ -79,7 +79,7 @@ const InlineFilesSection = ({ elements, isEditor }) => {
79
79
  react_1.default.createElement(ElementLabelContainer, null,
80
80
  (0, util_1.getFileTypeIcon)(element.type),
81
81
  react_1.default.createElement(ElementLabel, null, element.label)),
82
- react_1.default.createElement(ElementFilesContainer, null, (_a = element.files) === null || _a === void 0 ? void 0 : _a.map((file) => (react_1.default.createElement(ElementFile, { key: file.modelId, file: file, handleReplace: (f) => __awaiter(void 0, void 0, void 0, function* () { return yield replace(element, file, f); }), handleDetach: () => __awaiter(void 0, void 0, void 0, function* () { return yield detach(element, file); }), handleDownload: () => fileManagement.download(file) }))))));
82
+ react_1.default.createElement(ElementFilesContainer, { "data-cy": "file-elements-container" }, (_a = element.files) === null || _a === void 0 ? void 0 : _a.map((file) => (react_1.default.createElement(ElementFile, { key: file.modelId, file: file, handleReplace: (f) => __awaiter(void 0, void 0, void 0, function* () { return yield replace(element, file, f); }), handleDetach: () => __awaiter(void 0, void 0, void 0, function* () { return yield detach(element, file); }), handleDownload: () => fileManagement.download(file) }))))));
83
83
  })));
84
84
  };
85
85
  exports.InlineFilesSection = InlineFilesSection;
@@ -87,7 +87,7 @@ const ElementFile = ({ file, handleReplace, handleDownload, handleDetach }) => {
87
87
  return (react_1.default.createElement(ModelFileContainer, null,
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
- react_1.default.createElement(FileActions_1.FileActions, { sectionType: util_1.FileSectionType.Inline, handleDownload: file.id ? handleDownload : undefined, handleDetach: file.id ? handleDetach : undefined, handleReplace: handleReplace })));
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
91
  };
92
92
  const Element = styled_components_1.default.div `
93
93
  display: flex;
@@ -108,7 +108,7 @@ exports.ManuscriptNoteList = react_1.default.memo(({ createKeyword, deleteModel,
108
108
  items.length > 0 && (react_1.default.createElement(Checkbox, null,
109
109
  react_1.default.createElement(Checkbox_1.CheckboxField, { checked: selectResolved, onChange: handleOnSelectChange }),
110
110
  react_1.default.createElement(exports.LabelText, null, "See resolved")))),
111
- items.length >= 0 && (react_1.default.createElement(NoteListContainer, null, items.map(([target, noteData]) => {
111
+ items.length >= 0 && (react_1.default.createElement(NoteListContainer, { "data-cy": "notes-list" }, items.map(([target, noteData]) => {
112
112
  const isSelected = (selected &&
113
113
  (selected.node.attrs.id === target ||
114
114
  selected.node.attrs.rid === target)) ||
@@ -47,7 +47,7 @@ export const FileActions = ({ sectionType, handleDownload, handleReplace, handle
47
47
  showMove && (React.createElement(FileAction, { onClick: () => setMoveDialogOpen(true) },
48
48
  "Move to ",
49
49
  move.sectionType)))),
50
- showMove && (React.createElement(MoveFileConfirmationDialog, { isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })))) : (React.createElement(React.Fragment, null));
50
+ showMove && (React.createElement(MoveFileConfirmationDialog, { "data-cy": "file-move-confirm-dialog", isOpen: isMoveDialogOpen, close: () => setMoveDialogOpen(false), source: sectionType, target: move.sectionType, handleMove: move.handler })))) : (React.createElement(React.Fragment, null));
51
51
  };
52
52
  const MoveFileConfirmationDialog = ({ isOpen, close, source, target, handleMove }) => {
53
53
  const header = `Are you sure you want to move this file to “${target}”?`;
@@ -15,7 +15,7 @@ export const FileManager = ({ files, fileManagement, modelMap, saveModel, delete
15
15
  React.createElement(DragLayer, null),
16
16
  React.createElement(PermissionsContext.Provider, { value: can },
17
17
  React.createElement(InspectorSection, { title: 'Files', contentStyles: { margin: '24px 16px' } },
18
- React.createElement(InspectorTabs, { defaultIndex: 0, style: { overflow: 'visible' } },
18
+ React.createElement(InspectorTabs, { defaultIndex: 0, "data-cy": "files-tabs", style: { overflow: 'visible' } },
19
19
  React.createElement(InspectorTabList, null,
20
20
  React.createElement(InspectorTab, { "data-for": "inline", "data-tip": true }, "Inline files"),
21
21
  React.createElement(Tooltip, { id: "inline", place: "bottom", offset: { bottom: -11 }, effect: "solid", className: "tooltip" }, "Files that can be found inline in the manuscript."),
@@ -25,9 +25,9 @@ export const FileManager = ({ files, fileManagement, modelMap, saveModel, delete
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
27
  React.createElement(InspectorTabPanel, null,
28
- React.createElement(InlineFilesSection, { elements: inlineFiles, isEditor: enableDragAndDrop })),
28
+ React.createElement(InlineFilesSection, { "data-cy": "inline-files", elements: inlineFiles, isEditor: enableDragAndDrop })),
29
29
  React.createElement(InspectorTabPanel, null,
30
- React.createElement(SupplementsSection, { supplements: supplements })),
30
+ React.createElement(SupplementsSection, { "data-cy": "supplements-files", supplements: supplements })),
31
31
  React.createElement(InspectorTabPanel, null,
32
- React.createElement(OtherFilesSection, { files: otherFiles }))))))));
32
+ React.createElement(OtherFilesSection, { "data-cy": "other-files", files: otherFiles }))))))));
33
33
  };
@@ -41,7 +41,7 @@ export const FileUploader = ({ handler }) => {
41
41
  }),
42
42
  });
43
43
  const isActive = canDrop && isOver;
44
- return (React.createElement(Container, { ref: dropRef, active: isActive, onClick: openFileDialog },
44
+ return (React.createElement(Container, { ref: dropRef, "data-cy": "file-uploader", active: isActive, onClick: openFileDialog },
45
45
  React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: (e) => handleChange(e), value: '' }),
46
46
  "Drag or click to upload a new file"));
47
47
  };
@@ -50,14 +50,14 @@ export const InlineFilesSection = ({ elements, isEditor }) => {
50
50
  React.createElement(ElementLabelContainer, null,
51
51
  getFileTypeIcon(element.type),
52
52
  React.createElement(ElementLabel, null, element.label)),
53
- React.createElement(ElementFilesContainer, null, (_a = element.files) === null || _a === void 0 ? void 0 : _a.map((file) => (React.createElement(ElementFile, { key: file.modelId, file: file, handleReplace: (f) => __awaiter(void 0, void 0, void 0, function* () { return yield replace(element, file, f); }), handleDetach: () => __awaiter(void 0, void 0, void 0, function* () { return yield detach(element, file); }), handleDownload: () => fileManagement.download(file) }))))));
53
+ React.createElement(ElementFilesContainer, { "data-cy": "file-elements-container" }, (_a = element.files) === null || _a === void 0 ? void 0 : _a.map((file) => (React.createElement(ElementFile, { key: file.modelId, file: file, handleReplace: (f) => __awaiter(void 0, void 0, void 0, function* () { return yield replace(element, file, f); }), handleDetach: () => __awaiter(void 0, void 0, void 0, function* () { return yield detach(element, file); }), handleDownload: () => fileManagement.download(file) }))))));
54
54
  })));
55
55
  };
56
56
  const ElementFile = ({ file, handleReplace, handleDownload, handleDetach }) => {
57
57
  return (React.createElement(ModelFileContainer, null,
58
58
  React.createElement(FileName, { file: file }),
59
59
  React.createElement(FileCreatedDate, { file: file, className: "show-on-hover" }),
60
- React.createElement(FileActions, { sectionType: FileSectionType.Inline, handleDownload: file.id ? handleDownload : undefined, handleDetach: file.id ? handleDetach : undefined, handleReplace: handleReplace })));
60
+ React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Inline, handleDownload: file.id ? handleDownload : undefined, handleDetach: file.id ? handleDetach : undefined, handleReplace: handleReplace })));
61
61
  };
62
62
  const Element = styled.div `
63
63
  display: flex;
@@ -79,7 +79,7 @@ export const ManuscriptNoteList = React.memo(({ createKeyword, deleteModel, getC
79
79
  items.length > 0 && (React.createElement(Checkbox, null,
80
80
  React.createElement(CheckboxField, { checked: selectResolved, onChange: handleOnSelectChange }),
81
81
  React.createElement(LabelText, null, "See resolved")))),
82
- items.length >= 0 && (React.createElement(NoteListContainer, null, items.map(([target, noteData]) => {
82
+ items.length >= 0 && (React.createElement(NoteListContainer, { "data-cy": "notes-list" }, items.map(([target, noteData]) => {
83
83
  const isSelected = (selected &&
84
84
  (selected.node.attrs.id === target ||
85
85
  selected.node.attrs.rid === target)) ||
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.6.1",
4
+ "version": "1.6.2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",