@manuscripts/style-guide 1.2.1 → 1.2.2-LEAN-2705

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.
@@ -26,11 +26,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.FileDescription = exports.FileName = exports.FileNameContainer = exports.FileTitle = exports.FileNameTitleContainer = exports.FileInfoContainer = exports.FileInfo = void 0;
29
+ exports.FileDescription = exports.FileDate = exports.FileName = exports.FileNameContainer = exports.FileTitle = exports.FileNameTitleContainer = exports.FileInfoContainer = exports.FileDateContainer = exports.FileInfo = void 0;
30
+ const date_fns_1 = require("date-fns");
30
31
  const react_1 = __importStar(require("react"));
32
+ const react_tooltip_1 = __importDefault(require("react-tooltip"));
31
33
  const styled_components_1 = __importDefault(require("styled-components"));
32
34
  const FileManager_1 = require("../FileManager");
33
- const FileInfo = ({ showAttachmentName, title, fileAttachmentName, fileExtension, attachmentId, dispatch, }) => {
35
+ const FileInfo = ({ showAttachmentName, title, fileAttachmentName, fileExtension, attachmentId, dispatch, fileCreatedDate, }) => {
34
36
  const fileName = fileAttachmentName.substring(0, fileAttachmentName.lastIndexOf('.'));
35
37
  const can = (0, react_1.useContext)(FileManager_1.PermissionsContext);
36
38
  return (react_1.default.createElement(exports.FileInfoContainer, null,
@@ -42,9 +44,20 @@ const FileInfo = ({ showAttachmentName, title, fileAttachmentName, fileExtension
42
44
  react_1.default.createElement(exports.FileName, null, fileName),
43
45
  react_1.default.createElement("div", null,
44
46
  ".",
45
- fileExtension))))));
47
+ fileExtension))),
48
+ fileCreatedDate && (react_1.default.createElement(exports.FileDateContainer, { "data-tip": "tooltip-content" },
49
+ react_1.default.createElement(exports.FileDate, null, (0, date_fns_1.format)(new Date(fileCreatedDate), 'M/d/yy, HH:mm')),
50
+ react_1.default.createElement(react_tooltip_1.default, { place: "bottom", offset: { top: 0 }, effect: "solid", className: "tooltip" }, "File Uploaded"))))));
46
51
  };
47
52
  exports.FileInfo = FileInfo;
53
+ exports.FileDateContainer = styled_components_1.default.div `
54
+ line-height: 20px;
55
+ overflow: hidden;
56
+ width: 100%;
57
+ display: none;
58
+ display: flex;
59
+ justify-content: flex-end;
60
+ `;
48
61
  exports.FileInfoContainer = styled_components_1.default.div `
49
62
  margin-left: 8px;
50
63
  overflow: hidden;
@@ -53,10 +66,15 @@ exports.FileInfoContainer = styled_components_1.default.div `
53
66
  justify-content: center;
54
67
  align-items: start;
55
68
  width: 100%;
69
+
70
+ &:hover ${exports.FileDateContainer} {
71
+ display: flex;
72
+ }
56
73
  `;
57
74
  exports.FileNameTitleContainer = styled_components_1.default.div `
58
75
  display: flex;
59
76
  width: 100%;
77
+ align-items: baseline;
60
78
  `;
61
79
  exports.FileTitle = styled_components_1.default.div `
62
80
  color: ${(props) => props.theme.colors.text.primary};
@@ -79,6 +97,10 @@ exports.FileName = styled_components_1.default.div `
79
97
  text-overflow: ellipsis;
80
98
  white-space: nowrap;
81
99
  overflow: hidden;
100
+ width: 50px;
101
+ `;
102
+ exports.FileDate = styled_components_1.default.div `
103
+ font-size: font-size: ${(props) => props.theme.font.size.small};
82
104
  `;
83
105
  exports.FileDescription = styled_components_1.default.div `
84
106
  color: ${(props) => props.theme.colors.text.secondary};
@@ -27,7 +27,7 @@ const FileSectionItem = ({ fileSection, externalFile, title, showAttachmentName
27
27
  }
28
28
  } },
29
29
  react_1.default.createElement(FileTypeIcon_1.FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
30
- react_1.default.createElement(FileInfo_1.FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, fileAttachmentName: externalFile.name, title: title, attachmentId: externalFile.id, dispatch: dispatch })),
30
+ react_1.default.createElement(FileInfo_1.FileInfo, { fileExtension: fileExtension, fileCreatedDate: externalFile.createdDate, showAttachmentName: showAttachmentName, fileAttachmentName: externalFile.name, title: title, attachmentId: externalFile.id, dispatch: dispatch })),
31
31
  onClose && (react_1.default.createElement(IconCloseButton, { onClick: (e) => {
32
32
  e.preventDefault();
33
33
  onClose();
@@ -26,8 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.InlineFilesSection = void 0;
29
+ exports.FileDate = exports.FileDateContainer = exports.InlineFilesSection = void 0;
30
+ const date_fns_1 = require("date-fns");
30
31
  const react_1 = __importStar(require("react"));
32
+ const react_tooltip_1 = __importDefault(require("react-tooltip"));
31
33
  const styled_components_1 = __importDefault(require("styled-components"));
32
34
  const use_dropdown_1 = require("../../hooks/use-dropdown");
33
35
  const dots_icon_1 = __importDefault(require("../icons/dots-icon"));
@@ -52,7 +54,8 @@ const InlineFilesSection = ({ handleReplace, handleDownload, handleUpdateInline,
52
54
  return (react_1.default.createElement("div", null, inlineFiles.map((file, index) => {
53
55
  var _a;
54
56
  return (react_1.default.createElement(ElementItem, { className: 'item', key: index, id: file.id, onClick: onElementClick },
55
- react_1.default.createElement(FileReferences, { className: 'refItems' }, (_a = file.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment) => (react_1.default.createElement(FileReference, { key: attachment.id, attachment: attachment, handleReplace: handleReplace, handleUpdateInline: handleUpdateInline, handleDetachFile: handleDetachFile, handleDownload: handleDownload, dispatch: dispatch })))),
57
+ react_1.default.createElement(FileReferences, { className: 'refItems' }, (_a = file.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment) => (react_1.default.createElement(react_1.default.Fragment, null,
58
+ react_1.default.createElement(FileReference, { key: attachment.id, attachment: attachment, handleReplace: handleReplace, handleUpdateInline: handleUpdateInline, handleDetachFile: handleDetachFile, handleDownload: handleDownload, dispatch: dispatch }))))),
56
59
  react_1.default.createElement(Element, { className: 'element' },
57
60
  util_1.fileTypesWithIconMap.get(file.type),
58
61
  react_1.default.createElement(FileInfo_1.FileInfoContainer, null,
@@ -71,6 +74,9 @@ const FileReference = ({ attachment, handleReplace, handleDownload, handleUpdate
71
74
  react_1.default.createElement(Container, null,
72
75
  util_1.fileTypesWithIconMap.get(util_1.extensionsWithFileTypesMap.get(fileExtension)),
73
76
  react_1.default.createElement(FileReferenceName, null, attachment.name)),
77
+ attachment.createdDate && (react_1.default.createElement(exports.FileDateContainer, { "data-tip": "tooltip-content" },
78
+ react_1.default.createElement(exports.FileDate, null, (0, date_fns_1.format)(new Date(attachment.createdDate), 'M/d/yy, HH:mm')),
79
+ react_1.default.createElement(react_tooltip_1.default, { place: "bottom", offset: { top: 0 }, effect: "solid", className: "tooltip" }, "File Uploaded"))),
74
80
  handleDownload && handleReplace && (react_1.default.createElement(DropdownContainer, { ref: wrapperRef },
75
81
  react_1.default.createElement(FileSectionItem_1.ActionsIcon, { onClick: toggleOpen, type: "button", className: 'external_file_dropdown', "aria-label": "Download or Replace or Detach", "aria-pressed": isOpen },
76
82
  react_1.default.createElement(dots_icon_1.default, null)),
@@ -80,6 +86,12 @@ const FileReference = ({ attachment, handleReplace, handleDownload, handleUpdate
80
86
  attachment.modelId &&
81
87
  handleDetachFile(attachment.id, attachment.modelId), downloadAttachmentHandler: handleDownload, attachmentId: attachment.id, fileName: attachment.name, publicUrl: attachment.link, hideActionList: toggleOpen, dispatch: dispatch, dropDownClassName: 'ref_item_dropdown' }))))));
82
88
  };
89
+ exports.FileDateContainer = styled_components_1.default.div `
90
+ overflow: hidden;
91
+ display: none;
92
+ width: 100%;
93
+ justify-content: flex-end;
94
+ `;
83
95
  const ElementItem = (0, styled_components_1.default)(FileSectionItem_1.Item) `
84
96
  display: flex;
85
97
  // this will allow us to select the previous sibling node,
@@ -94,6 +106,9 @@ const ElementItem = (0, styled_components_1.default)(FileSectionItem_1.Item) `
94
106
  .refItems:hover ~ .element {
95
107
  background: white !important;
96
108
  }
109
+ &:hover ${exports.FileDateContainer} {
110
+ display: flex;
111
+ }
97
112
 
98
113
  .refItems:hover {
99
114
  background: white !important;
@@ -107,18 +122,24 @@ const ElementItem = (0, styled_components_1.default)(FileSectionItem_1.Item) `
107
122
  `;
108
123
  const Container = styled_components_1.default.div `
109
124
  display: flex;
125
+ width: 100%;
110
126
  `;
111
127
  const Element = styled_components_1.default.div `
112
128
  display: flex;
113
129
  padding: 20px 15px;
114
130
  `;
115
- const FileReferences = styled_components_1.default.div ``;
116
- const FileReferenceItem = styled_components_1.default.div `
131
+ const FileReferences = styled_components_1.default.div `
117
132
  display: flex;
118
133
  align-items: center;
119
134
  justify-content: space-between;
120
-
121
- svg {
135
+ width: 100%;
136
+ `;
137
+ const FileReferenceItem = styled_components_1.default.div `
138
+ display: flex;
139
+ width: 100%;
140
+ align-items: space;
141
+ justify-content: space-between;
142
+ width: 100% svg {
122
143
  width: 14px;
123
144
  height: 17px;
124
145
  }
@@ -161,3 +182,7 @@ const FileReferenceName = styled_components_1.default.div `
161
182
  const DropdownContainer = styled_components_1.default.div `
162
183
  position: relative;
163
184
  `;
185
+ exports.FileDate = styled_components_1.default.div `
186
+ font-size: ${(props) => props.theme.font.size.small};
187
+ line-height: 27px;
188
+ `;
@@ -59,6 +59,7 @@ const getCapabilities = (project, profile, role, actions) => {
59
59
  editMetadata: !(isViewer() || isAnnotator() || isProofer()),
60
60
  editCitationsAndRefs: !(isViewer() || isAnnotator() || isProofer()),
61
61
  shareProject: isOwner(),
62
+ applySaveChanges: !(isAnnotator() || isProofer()),
62
63
  };
63
64
  };
64
65
  exports.getCapabilities = getCapabilities;
@@ -1,7 +1,9 @@
1
+ import { format } from 'date-fns';
1
2
  import React, { useContext } from 'react';
3
+ import ReactTooltip from 'react-tooltip';
2
4
  import styled from 'styled-components';
3
5
  import { PermissionsContext } from '../FileManager';
4
- export const FileInfo = ({ showAttachmentName, title, fileAttachmentName, fileExtension, attachmentId, dispatch, }) => {
6
+ export const FileInfo = ({ showAttachmentName, title, fileAttachmentName, fileExtension, attachmentId, dispatch, fileCreatedDate, }) => {
5
7
  const fileName = fileAttachmentName.substring(0, fileAttachmentName.lastIndexOf('.'));
6
8
  const can = useContext(PermissionsContext);
7
9
  return (React.createElement(FileInfoContainer, null,
@@ -13,8 +15,19 @@ export const FileInfo = ({ showAttachmentName, title, fileAttachmentName, fileEx
13
15
  React.createElement(FileName, null, fileName),
14
16
  React.createElement("div", null,
15
17
  ".",
16
- fileExtension))))));
18
+ fileExtension))),
19
+ fileCreatedDate && (React.createElement(FileDateContainer, { "data-tip": "tooltip-content" },
20
+ React.createElement(FileDate, null, format(new Date(fileCreatedDate), 'M/d/yy, HH:mm')),
21
+ React.createElement(ReactTooltip, { place: "bottom", offset: { top: 0 }, effect: "solid", className: "tooltip" }, "File Uploaded"))))));
17
22
  };
23
+ export const FileDateContainer = styled.div `
24
+ line-height: 20px;
25
+ overflow: hidden;
26
+ width: 100%;
27
+ display: none;
28
+ display: flex;
29
+ justify-content: flex-end;
30
+ `;
18
31
  export const FileInfoContainer = styled.div `
19
32
  margin-left: 8px;
20
33
  overflow: hidden;
@@ -23,10 +36,15 @@ export const FileInfoContainer = styled.div `
23
36
  justify-content: center;
24
37
  align-items: start;
25
38
  width: 100%;
39
+
40
+ &:hover ${FileDateContainer} {
41
+ display: flex;
42
+ }
26
43
  `;
27
44
  export const FileNameTitleContainer = styled.div `
28
45
  display: flex;
29
46
  width: 100%;
47
+ align-items: baseline;
30
48
  `;
31
49
  export const FileTitle = styled.div `
32
50
  color: ${(props) => props.theme.colors.text.primary};
@@ -49,6 +67,10 @@ export const FileName = styled.div `
49
67
  text-overflow: ellipsis;
50
68
  white-space: nowrap;
51
69
  overflow: hidden;
70
+ width: 50px;
71
+ `;
72
+ export const FileDate = styled.div `
73
+ font-size: font-size: ${(props) => props.theme.font.size.small};
52
74
  `;
53
75
  export const FileDescription = styled.div `
54
76
  color: ${(props) => props.theme.colors.text.secondary};
@@ -21,7 +21,7 @@ export const FileSectionItem = ({ fileSection, externalFile, title, showAttachme
21
21
  }
22
22
  } },
23
23
  React.createElement(FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
24
- React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, fileAttachmentName: externalFile.name, title: title, attachmentId: externalFile.id, dispatch: dispatch })),
24
+ React.createElement(FileInfo, { fileExtension: fileExtension, fileCreatedDate: externalFile.createdDate, showAttachmentName: showAttachmentName, fileAttachmentName: externalFile.name, title: title, attachmentId: externalFile.id, dispatch: dispatch })),
25
25
  onClose && (React.createElement(IconCloseButton, { onClick: (e) => {
26
26
  e.preventDefault();
27
27
  onClose();
@@ -1,4 +1,6 @@
1
+ import { format } from 'date-fns';
1
2
  import React, { useCallback } from 'react';
3
+ import ReactTooltip from 'react-tooltip';
2
4
  import styled from 'styled-components';
3
5
  import { useDropdown } from '../../hooks/use-dropdown';
4
6
  import DotsIcon from '../icons/dots-icon';
@@ -23,7 +25,8 @@ export const InlineFilesSection = ({ handleReplace, handleDownload, handleUpdate
23
25
  return (React.createElement("div", null, inlineFiles.map((file, index) => {
24
26
  var _a;
25
27
  return (React.createElement(ElementItem, { className: 'item', key: index, id: file.id, onClick: onElementClick },
26
- React.createElement(FileReferences, { className: 'refItems' }, (_a = file.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment) => (React.createElement(FileReference, { key: attachment.id, attachment: attachment, handleReplace: handleReplace, handleUpdateInline: handleUpdateInline, handleDetachFile: handleDetachFile, handleDownload: handleDownload, dispatch: dispatch })))),
28
+ React.createElement(FileReferences, { className: 'refItems' }, (_a = file.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment) => (React.createElement(React.Fragment, null,
29
+ React.createElement(FileReference, { key: attachment.id, attachment: attachment, handleReplace: handleReplace, handleUpdateInline: handleUpdateInline, handleDetachFile: handleDetachFile, handleDownload: handleDownload, dispatch: dispatch }))))),
27
30
  React.createElement(Element, { className: 'element' },
28
31
  fileTypesWithIconMap.get(file.type),
29
32
  React.createElement(FileInfoContainer, null,
@@ -41,6 +44,9 @@ const FileReference = ({ attachment, handleReplace, handleDownload, handleUpdate
41
44
  React.createElement(Container, null,
42
45
  fileTypesWithIconMap.get(extensionsWithFileTypesMap.get(fileExtension)),
43
46
  React.createElement(FileReferenceName, null, attachment.name)),
47
+ attachment.createdDate && (React.createElement(FileDateContainer, { "data-tip": "tooltip-content" },
48
+ React.createElement(FileDate, null, format(new Date(attachment.createdDate), 'M/d/yy, HH:mm')),
49
+ React.createElement(ReactTooltip, { place: "bottom", offset: { top: 0 }, effect: "solid", className: "tooltip" }, "File Uploaded"))),
44
50
  handleDownload && handleReplace && (React.createElement(DropdownContainer, { ref: wrapperRef },
45
51
  React.createElement(ActionsIcon, { onClick: toggleOpen, type: "button", className: 'external_file_dropdown', "aria-label": "Download or Replace or Detach", "aria-pressed": isOpen },
46
52
  React.createElement(DotsIcon, null)),
@@ -50,6 +56,12 @@ const FileReference = ({ attachment, handleReplace, handleDownload, handleUpdate
50
56
  attachment.modelId &&
51
57
  handleDetachFile(attachment.id, attachment.modelId), downloadAttachmentHandler: handleDownload, attachmentId: attachment.id, fileName: attachment.name, publicUrl: attachment.link, hideActionList: toggleOpen, dispatch: dispatch, dropDownClassName: 'ref_item_dropdown' }))))));
52
58
  };
59
+ export const FileDateContainer = styled.div `
60
+ overflow: hidden;
61
+ display: none;
62
+ width: 100%;
63
+ justify-content: flex-end;
64
+ `;
53
65
  const ElementItem = styled(Item) `
54
66
  display: flex;
55
67
  // this will allow us to select the previous sibling node,
@@ -64,6 +76,9 @@ const ElementItem = styled(Item) `
64
76
  .refItems:hover ~ .element {
65
77
  background: white !important;
66
78
  }
79
+ &:hover ${FileDateContainer} {
80
+ display: flex;
81
+ }
67
82
 
68
83
  .refItems:hover {
69
84
  background: white !important;
@@ -77,18 +92,24 @@ const ElementItem = styled(Item) `
77
92
  `;
78
93
  const Container = styled.div `
79
94
  display: flex;
95
+ width: 100%;
80
96
  `;
81
97
  const Element = styled.div `
82
98
  display: flex;
83
99
  padding: 20px 15px;
84
100
  `;
85
- const FileReferences = styled.div ``;
86
- const FileReferenceItem = styled.div `
101
+ const FileReferences = styled.div `
87
102
  display: flex;
88
103
  align-items: center;
89
104
  justify-content: space-between;
90
-
91
- svg {
105
+ width: 100%;
106
+ `;
107
+ const FileReferenceItem = styled.div `
108
+ display: flex;
109
+ width: 100%;
110
+ align-items: space;
111
+ justify-content: space-between;
112
+ width: 100% svg {
92
113
  width: 14px;
93
114
  height: 17px;
94
115
  }
@@ -131,3 +152,7 @@ const FileReferenceName = styled.div `
131
152
  const DropdownContainer = styled.div `
132
153
  position: relative;
133
154
  `;
155
+ export const FileDate = styled.div `
156
+ font-size: ${(props) => props.theme.font.size.small};
157
+ line-height: 27px;
158
+ `;
@@ -53,6 +53,7 @@ export const getCapabilities = (project, profile, role, actions) => {
53
53
  editMetadata: !(isViewer() || isAnnotator() || isProofer()),
54
54
  editCitationsAndRefs: !(isViewer() || isAnnotator() || isProofer()),
55
55
  shareProject: isOwner(),
56
+ applySaveChanges: !(isAnnotator() || isProofer()),
56
57
  };
57
58
  };
58
59
  export const getAllPermitted = () => {
@@ -6,11 +6,14 @@ export declare const FileInfo: React.FC<{
6
6
  fileAttachmentName: string;
7
7
  fileExtension: string;
8
8
  attachmentId: string;
9
+ fileCreatedDate: Date;
9
10
  dispatch?: Dispatch<Action>;
10
11
  }>;
12
+ export declare const FileDateContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
11
13
  export declare const FileInfoContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
14
  export declare const FileNameTitleContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
13
15
  export declare const FileTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
16
  export declare const FileNameContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
15
17
  export declare const FileName: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
18
+ export declare const FileDate: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
16
19
  export declare const FileDescription: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -9,6 +9,7 @@ export type FileAttachment = {
9
9
  name: string;
10
10
  type: FileAttachmentType;
11
11
  link: string;
12
+ createdDate: Date;
12
13
  };
13
14
  export type FileAttachmentType = {
14
15
  id: string;
@@ -18,3 +18,5 @@ export declare const InlineFilesSection: React.FC<{
18
18
  isEditor: boolean;
19
19
  dispatch: Dispatch<Action>;
20
20
  }>;
21
+ export declare const FileDateContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
22
+ export declare const FileDate: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -38,6 +38,7 @@ export type Capabilities = {
38
38
  editMetadata: boolean;
39
39
  shareProject: boolean;
40
40
  editCitationsAndRefs: boolean;
41
+ applySaveChanges: boolean;
41
42
  };
42
43
  export interface ProviderProps {
43
44
  project?: Project;
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.2.1",
4
+ "version": "1.2.2-LEAN-2705",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",