@manuscripts/style-guide 1.4.3 → 1.4.5-LEAN-3019

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 (40) hide show
  1. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditor.js +2 -4
  2. package/dist/cjs/components/Comments/index.js +21 -0
  3. package/dist/cjs/components/DatePicker/CalendarDatePicker.js +153 -0
  4. package/dist/cjs/components/DatePicker/index.js +17 -0
  5. package/dist/cjs/components/NavDropdown.js +2 -7
  6. package/dist/cjs/components/icons/plus-icon.js +3 -3
  7. package/dist/cjs/index.js +8 -3
  8. package/dist/es/components/AffiliationsEditor/AffiliationsEditor.js +2 -4
  9. package/dist/es/components/Comments/index.js +5 -0
  10. package/dist/es/components/DatePicker/CalendarDatePicker.js +121 -0
  11. package/dist/es/components/DatePicker/index.js +1 -0
  12. package/dist/es/components/NavDropdown.js +1 -6
  13. package/dist/es/components/icons/plus-icon.js +3 -3
  14. package/dist/es/index.js +8 -3
  15. package/dist/types/components/Comments/index.d.ts +5 -0
  16. package/dist/types/components/DatePicker/CalendarDatePicker.d.ts +32 -0
  17. package/dist/types/components/DatePicker/index.d.ts +1 -0
  18. package/dist/types/components/NavDropdown.d.ts +0 -2
  19. package/dist/types/components/icons/plus-icon.d.ts +3 -1
  20. package/dist/types/components/icons/types.d.ts +2 -0
  21. package/dist/types/index.d.ts +8 -3
  22. package/package.json +3 -4
  23. package/dist/cjs/components/SubmissionInspector/BaseInformation.js +0 -273
  24. package/dist/cjs/components/SubmissionInspector/Button.js +0 -31
  25. package/dist/cjs/components/SubmissionInspector/Progress.js +0 -86
  26. package/dist/cjs/components/SubmissionInspector/index.js +0 -43
  27. package/dist/cjs/components/SubmissionInspector/types.js +0 -24
  28. package/dist/es/components/SubmissionInspector/BaseInformation.js +0 -243
  29. package/dist/es/components/SubmissionInspector/Button.js +0 -25
  30. package/dist/es/components/SubmissionInspector/Progress.js +0 -79
  31. package/dist/es/components/SubmissionInspector/index.js +0 -27
  32. package/dist/es/components/SubmissionInspector/types.js +0 -21
  33. package/dist/types/components/SubmissionInspector/BaseInformation.d.ts +0 -24
  34. package/dist/types/components/SubmissionInspector/Button.d.ts +0 -27
  35. package/dist/types/components/SubmissionInspector/Progress.d.ts +0 -20
  36. package/dist/types/components/SubmissionInspector/index.d.ts +0 -27
  37. package/dist/types/components/SubmissionInspector/types.d.ts +0 -88
  38. /package/dist/cjs/components/{SubmissionInspector/Text.js → Text.js} +0 -0
  39. /package/dist/es/components/{SubmissionInspector/Text.js → Text.js} +0 -0
  40. /package/dist/types/components/{SubmissionInspector/Text.d.ts → Text.d.ts} +0 -0
@@ -49,12 +49,10 @@ const AffiliationsEditor = ({ affiliations, authorAffiliations, addAuthorAffilia
49
49
  const handleChoose = (0, react_1.useCallback)((value) => {
50
50
  if (value) {
51
51
  const selectedAffiliation = value;
52
- addAuthorAffiliation(selectedAffiliation.__isNew__
53
- ? selectedAffiliation.value
54
- : affiliations.get(selectedAffiliation.value) || '');
52
+ addAuthorAffiliation(selectedAffiliation.value);
55
53
  }
56
54
  setSearchText('');
57
- }, [addAuthorAffiliation, affiliations]);
55
+ }, [addAuthorAffiliation]);
58
56
  const options = (0, authors_1.affiliationsOptions)(affiliations, authorAffiliations);
59
57
  const active = authorAffiliations
60
58
  ? authorAffiliations.map((item) => item.data)
@@ -0,0 +1,21 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CommentBody"), exports);
18
+ __exportStar(require("./CommentTarget"), exports);
19
+ __exportStar(require("./CommentUser"), exports);
20
+ __exportStar(require("./ResolveButton"), exports);
21
+ __exportStar(require("./CommentWrapper"), exports);
@@ -0,0 +1,153 @@
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.CalendarDatePicker = exports.calendarDatePickerDefaultDateFormat = exports.calendarPotentialDueDate = exports.calendarGetDay = void 0;
30
+ require("react-modern-calendar-datepicker/lib/DatePicker.css");
31
+ const date_fns_1 = require("date-fns");
32
+ const react_1 = __importStar(require("react"));
33
+ const react_modern_calendar_datepicker_1 = __importDefault(require("react-modern-calendar-datepicker"));
34
+ const styled_components_1 = __importDefault(require("styled-components"));
35
+ const Dialog_1 = require("../Dialog");
36
+ const calendarGetDay = (date) => ({
37
+ year: date.getFullYear(),
38
+ month: date.getMonth() + 1,
39
+ day: date.getDate(),
40
+ });
41
+ exports.calendarGetDay = calendarGetDay;
42
+ const calendarPotentialDueDate = (stepDueDate, dueDate, submissionDueDate) => {
43
+ const duration = (0, date_fns_1.intervalToDuration)({
44
+ start: stepDueDate,
45
+ end: new Date(`${dueDate.year}-${dueDate.month < 10 ? `0${dueDate.month}` : dueDate.month}-${dueDate.day < 10 ? `0${dueDate.day}` : dueDate.day}`),
46
+ });
47
+ return (0, date_fns_1.add)(submissionDueDate, duration);
48
+ };
49
+ exports.calendarPotentialDueDate = calendarPotentialDueDate;
50
+ const calendarDatePickerDefaultDateFormat = 'd MMM, EEEE';
51
+ exports.calendarDatePickerDefaultDateFormat = calendarDatePickerDefaultDateFormat;
52
+ const CalendarDatePicker = ({ Button, handleDateChange, originalDueDate, currentDueDate, datePickerConfigs, dialogConfigs, primaryButtonTitle = 'Reschedule', secondaryButtonTitle = 'Cancel', }) => {
53
+ datePickerConfigs = Object.assign({ position: 'bottom', color: '#f2fbfc', selectedDayClassName: 'selected-day', calendarClassName: 'responsive-calendar' }, datePickerConfigs);
54
+ const dialog = Object.assign({}, dialogConfigs, {
55
+ header: 'Change the task due date?',
56
+ });
57
+ const [dueDate, setDueDate] = (0, react_1.useState)();
58
+ const [toggleDialog, setToggleDialog] = (0, react_1.useState)(false);
59
+ const onConfirmClick = (0, react_1.useCallback)(() => {
60
+ handleDateChange(dueDate);
61
+ setToggleDialog(false);
62
+ }, [dueDate, setToggleDialog, handleDateChange]);
63
+ const formattedDueDate = (0, react_1.useMemo)(() => dueDate &&
64
+ (0, date_fns_1.format)(new Date(dueDate.year, dueDate.month, dueDate.day), calendarDatePickerDefaultDateFormat), [dueDate]);
65
+ const formattedPotentialDueDate = (0, react_1.useMemo)(() => dueDate &&
66
+ (0, date_fns_1.format)(calendarPotentialDueDate(currentDueDate, dueDate, originalDueDate), calendarDatePickerDefaultDateFormat), [originalDueDate, currentDueDate, dueDate]);
67
+ const onDatePickerChange = (0, react_1.useCallback)((date) => {
68
+ setDueDate(date);
69
+ setToggleDialog(true);
70
+ const button = document.querySelector('.DatePicker button');
71
+ button.blur();
72
+ }, []);
73
+ return (react_1.default.createElement(react_1.default.Fragment, null,
74
+ react_1.default.createElement(Calendar, null,
75
+ react_1.default.createElement(react_modern_calendar_datepicker_1.default, { value: calendarGetDay(currentDueDate), onChange: onDatePickerChange, calendarPopperPosition: datePickerConfigs.position, colorPrimary: datePickerConfigs.color, calendarSelectedDayClassName: datePickerConfigs.selectedDayClassName, calendarClassName: datePickerConfigs.calendarClassName, renderInput: Button })),
76
+ react_1.default.createElement(Dialog_1.Dialog, { isOpen: toggleDialog, category: Dialog_1.Category.confirmation, header: dialog.header, message: react_1.default.createElement(react_1.default.Fragment, null,
77
+ react_1.default.createElement(UpdatedDueDate, null, formattedDueDate),
78
+ dialog.dueDateMessage && (react_1.default.createElement(DueDateMessage, null, dialog.dueDateMessage)),
79
+ react_1.default.createElement(Value, null,
80
+ react_1.default.createElement(StrikeDueDate, { as: 'del' }, (0, date_fns_1.format)(originalDueDate, calendarDatePickerDefaultDateFormat)),
81
+ formattedPotentialDueDate)), actions: {
82
+ primary: {
83
+ action: onConfirmClick,
84
+ title: primaryButtonTitle,
85
+ },
86
+ secondary: {
87
+ action: () => setToggleDialog(false),
88
+ title: secondaryButtonTitle,
89
+ },
90
+ } })));
91
+ };
92
+ exports.CalendarDatePicker = CalendarDatePicker;
93
+ const StrikeDueDate = (0, styled_components_1.default)(Dialog_1.MessageContainer) `
94
+ margin: 0;
95
+ min-height: min-content;
96
+ padding-right: ${(props) => props.theme.grid.unit}px;
97
+ `;
98
+ const Value = styled_components_1.default.div `
99
+ flex: 1;
100
+ display: flex;
101
+ color: ${(props) => props.theme.colors.text.primary};
102
+ align-items: center;
103
+ line-height: 1;
104
+ `;
105
+ const Calendar = styled_components_1.default.div `
106
+ flex: 1;
107
+
108
+ .DatePicker {
109
+ width: 100%;
110
+ }
111
+
112
+ .DatePicker__calendarContainer {
113
+ position: absolute;
114
+ top: unset;
115
+ left: unset !important;
116
+ right: 0 !important;
117
+ transform: unset !important;
118
+ }
119
+
120
+ .Calendar__weekDay {
121
+ color: #e6e6e6;
122
+ font-size: ${(props) => props.theme.font.size.normal};
123
+ line-height: ${(props) => props.theme.font.lineHeight.large};
124
+ font-weight: ${(props) => props.theme.font.weight.medium};
125
+ }
126
+
127
+ .Calendar__day:not(.-blank):not(.-selected):hover {
128
+ background: #f2fbfc !important;
129
+ }
130
+
131
+ .Calendar__day.-today:hover::after {
132
+ opacity: 0.5 !important;
133
+ }
134
+
135
+ .selected-day {
136
+ color: ${(props) => props.theme.colors.text.primary} !important;
137
+ border: 1px solid ${(props) => props.theme.colors.border.primary} !important;
138
+ }
139
+ `;
140
+ const UpdatedDueDate = styled_components_1.default.div `
141
+ background: ${(props) => props.theme.colors.background.secondary};
142
+ color: ${(props) => props.theme.colors.text.primary};
143
+ width: max-content;
144
+ border: 1px solid ${(props) => props.theme.colors.border.secondary};
145
+ box-sizing: border-box;
146
+ border-radius: ${(props) => props.theme.grid.unit}px;
147
+ padding: ${(props) => props.theme.grid.unit}px
148
+ ${(props) => props.theme.grid.unit * 2}px;
149
+ `;
150
+ const DueDateMessage = (0, styled_components_1.default)(Dialog_1.MessageContainer) `
151
+ min-height: min-content;
152
+ margin: ${(props) => props.theme.grid.unit * 6}px 0 0 0;
153
+ `;
@@ -0,0 +1,17 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CalendarDatePicker"), exports);
@@ -41,9 +41,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
41
41
  return (mod && mod.__esModule) ? mod : { "default": mod };
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.NavDropdownButton = exports.NavDropdownButtonContainer = exports.NotificationsBadge = exports.NavDropdownToggle = exports.NavDropdownButtonText = exports.NavDropdownSeparator = exports.NavDropdownElement = exports.NavDropdownLink = exports.InvitedBy = exports.PlaceholderTitle = exports.NavDropdown = exports.NavDropdownContainer = void 0;
44
+ exports.NavDropdownButton = exports.NavDropdownButtonContainer = exports.NotificationsBadge = exports.NavDropdownToggle = exports.NavDropdownButtonText = exports.NavDropdownSeparator = exports.NavDropdownElement = exports.NavDropdownLink = exports.InvitedBy = exports.NavDropdown = exports.NavDropdownContainer = void 0;
45
45
  const ArrowDownUp_1 = __importDefault(require("@manuscripts/assets/react/ArrowDownUp"));
46
- const title_editor_1 = require("@manuscripts/title-editor");
47
46
  const react_1 = __importDefault(require("react"));
48
47
  const react_router_dom_1 = require("react-router-dom");
49
48
  const styled_components_1 = __importStar(require("styled-components"));
@@ -72,9 +71,6 @@ exports.NavDropdown = styled_components_1.default.div `
72
71
  position: absolute;
73
72
  z-index: 10;
74
73
  `;
75
- exports.PlaceholderTitle = (0, styled_components_1.default)(title_editor_1.Title) `
76
- color: ${(props) => props.theme.colors.text.secondary};
77
- `;
78
74
  exports.InvitedBy = styled_components_1.default.div `
79
75
  display: flex;
80
76
  align-items: center;
@@ -97,8 +93,7 @@ const commonStyles = (0, styled_components_1.css) `
97
93
  : props.theme.colors.text.primary};
98
94
  pointer-events: ${(props) => (props.disabled ? 'none' : 'unset')};
99
95
 
100
- &:hover,
101
- &:hover ${exports.PlaceholderTitle} {
96
+ &:hover {
102
97
  background: ${(props) => props.theme.colors.background.fifth};
103
98
  }
104
99
  `;
@@ -20,8 +20,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.PlusIcon = void 0;
22
22
  const react_1 = __importDefault(require("react"));
23
- const PlusIcon = () => (react_1.default.createElement("svg", { width: "11", height: "10", viewBox: "0 0 11 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
24
- react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 0.5C5.25147 0.5 5.05 0.701472 5.05 0.95V4.55H1.45C1.20147 4.55 1 4.75147 1 5C1 5.24853 1.20147 5.45 1.45 5.45H5.05V9.05C5.05 9.29853 5.25147 9.5 5.5 9.5C5.74853 9.5 5.95 9.29853 5.95 9.05V5.45H9.55C9.79853 5.45 10 5.24853 10 5C10 4.75147 9.79853 4.55 9.55 4.55H5.95V0.95C5.95 0.701472 5.74853 0.5 5.5 0.5Z", fill: "#6E6E6E" }),
25
- react_1.default.createElement("path", { d: "M5.05 4.55V5.05H5.55V4.55H5.05ZM5.05 5.45H5.55V4.95H5.05V5.45ZM5.95 5.45V4.95H5.45V5.45H5.95ZM5.95 4.55H5.45V5.05H5.95V4.55ZM5.55 0.95C5.55 0.977614 5.52761 1 5.5 1V0C4.97533 0 4.55 0.425329 4.55 0.95H5.55ZM5.55 4.55V0.95H4.55V4.55H5.55ZM1.45 5.05H5.05V4.05H1.45V5.05ZM1.5 5C1.5 5.02761 1.47761 5.05 1.45 5.05V4.05C0.925329 4.05 0.5 4.47533 0.5 5H1.5ZM1.45 4.95C1.47761 4.95 1.5 4.97239 1.5 5H0.5C0.5 5.52467 0.925328 5.95 1.45 5.95V4.95ZM5.05 4.95H1.45V5.95H5.05V4.95ZM5.55 9.05V5.45H4.55V9.05H5.55ZM5.5 9C5.52761 9 5.55 9.02239 5.55 9.05H4.55C4.55 9.57467 4.97533 10 5.5 10V9ZM5.45 9.05C5.45 9.02239 5.47239 9 5.5 9V10C6.02467 10 6.45 9.57467 6.45 9.05H5.45ZM5.45 5.45V9.05H6.45V5.45H5.45ZM9.55 4.95H5.95V5.95H9.55V4.95ZM9.5 5C9.5 4.97239 9.52238 4.95 9.55 4.95V5.95C10.0747 5.95 10.5 5.52467 10.5 5H9.5ZM9.55 5.05C9.52239 5.05 9.5 5.02761 9.5 5H10.5C10.5 4.47533 10.0747 4.05 9.55 4.05V5.05ZM5.95 5.05H9.55V4.05H5.95V5.05ZM5.45 0.95V4.55H6.45V0.95H5.45ZM5.5 1C5.47239 1 5.45 0.977615 5.45 0.95H6.45C6.45 0.425329 6.02467 0 5.5 0V1Z", fill: "#6E6E6E" })));
23
+ const PlusIcon = ({ width = 11, height = 10, viewBox = '0 0 11 10', color = '#6E6E6E', transform, }) => (react_1.default.createElement("svg", { width: width, height: height, viewBox: viewBox, fill: "none", xmlns: "http://www.w3.org/2000/svg", transform: transform },
24
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 0.5C5.25147 0.5 5.05 0.701472 5.05 0.95V4.55H1.45C1.20147 4.55 1 4.75147 1 5C1 5.24853 1.20147 5.45 1.45 5.45H5.05V9.05C5.05 9.29853 5.25147 9.5 5.5 9.5C5.74853 9.5 5.95 9.29853 5.95 9.05V5.45H9.55C9.79853 5.45 10 5.24853 10 5C10 4.75147 9.79853 4.55 9.55 4.55H5.95V0.95C5.95 0.701472 5.74853 0.5 5.5 0.5Z", fill: color }),
25
+ react_1.default.createElement("path", { d: "M5.05 4.55V5.05H5.55V4.55H5.05ZM5.05 5.45H5.55V4.95H5.05V5.45ZM5.95 5.45V4.95H5.45V5.45H5.95ZM5.95 4.55H5.45V5.05H5.95V4.55ZM5.55 0.95C5.55 0.977614 5.52761 1 5.5 1V0C4.97533 0 4.55 0.425329 4.55 0.95H5.55ZM5.55 4.55V0.95H4.55V4.55H5.55ZM1.45 5.05H5.05V4.05H1.45V5.05ZM1.5 5C1.5 5.02761 1.47761 5.05 1.45 5.05V4.05C0.925329 4.05 0.5 4.47533 0.5 5H1.5ZM1.45 4.95C1.47761 4.95 1.5 4.97239 1.5 5H0.5C0.5 5.52467 0.925328 5.95 1.45 5.95V4.95ZM5.05 4.95H1.45V5.95H5.05V4.95ZM5.55 9.05V5.45H4.55V9.05H5.55ZM5.5 9C5.52761 9 5.55 9.02239 5.55 9.05H4.55C4.55 9.57467 4.97533 10 5.5 10V9ZM5.45 9.05C5.45 9.02239 5.47239 9 5.5 9V10C6.02467 10 6.45 9.57467 6.45 9.05H5.45ZM5.45 5.45V9.05H6.45V5.45H5.45ZM9.55 4.95H5.95V5.95H9.55V4.95ZM9.5 5C9.5 4.97239 9.52238 4.95 9.55 4.95V5.95C10.0747 5.95 10.5 5.52467 10.5 5H9.5ZM9.55 5.05C9.52239 5.05 9.5 5.02761 9.5 5H10.5C10.5 4.47533 10.0747 4.05 9.55 4.05V5.05ZM5.95 5.05H9.55V4.05H5.95V5.05ZM5.45 0.95V4.55H6.45V0.95H5.45ZM5.5 1C5.47239 1 5.45 0.977615 5.45 0.95H6.45C6.45 0.425329 6.02467 0 5.5 0V1Z", fill: color })));
26
26
  exports.PlusIcon = PlusIcon;
27
27
  exports.default = exports.PlusIcon;
package/dist/cjs/index.js CHANGED
@@ -65,8 +65,14 @@ __exportStar(require("./components/Inspector"), exports);
65
65
  __exportStar(require("./components/InspectorSection"), exports);
66
66
  __exportStar(require("./components/Badge"), exports);
67
67
  __exportStar(require("./components/NavDropdown"), exports);
68
- __exportStar(require("./components/SubmissionInspector"), exports);
69
68
  __exportStar(require("./components/Dropdown"), exports);
69
+ __exportStar(require("./components/LoadingOverlay"), exports);
70
+ __exportStar(require("./components/EditorHeader/EditorHeader"), exports);
71
+ __exportStar(require("./components/DatePicker"), exports);
72
+ __exportStar(require("./components/Text"), exports);
73
+ __exportStar(require("./components/ManuscriptNoteList"), exports);
74
+ __exportStar(require("./components/Comments"), exports);
75
+ __exportStar(require("./components/RelativeDate"), exports);
70
76
  __exportStar(require("./hooks/use-dropdown"), exports);
71
77
  __exportStar(require("./hooks/use-files"), exports);
72
78
  var use_deep_compare_1 = require("./hooks/use-deep-compare");
@@ -75,8 +81,7 @@ Object.defineProperty(exports, "useDeepCompareCallback", { enumerable: true, get
75
81
  __exportStar(require("./lib/authors"), exports);
76
82
  __exportStar(require("./lib/capabilities"), exports);
77
83
  __exportStar(require("./lib/files"), exports);
84
+ __exportStar(require("./lib/comments"), exports);
78
85
  var errors_decoder_1 = require("./lib/errors-decoder");
79
86
  Object.defineProperty(exports, "errorsDecoder", { enumerable: true, get: function () { return __importDefault(errors_decoder_1).default; } });
80
87
  __exportStar(require("./types"), exports);
81
- __exportStar(require("./components/LoadingOverlay"), exports);
82
- __exportStar(require("./components/EditorHeader/EditorHeader"), exports);
@@ -21,12 +21,10 @@ const AffiliationsEditor = ({ affiliations, authorAffiliations, addAuthorAffilia
21
21
  const handleChoose = useCallback((value) => {
22
22
  if (value) {
23
23
  const selectedAffiliation = value;
24
- addAuthorAffiliation(selectedAffiliation.__isNew__
25
- ? selectedAffiliation.value
26
- : affiliations.get(selectedAffiliation.value) || '');
24
+ addAuthorAffiliation(selectedAffiliation.value);
27
25
  }
28
26
  setSearchText('');
29
- }, [addAuthorAffiliation, affiliations]);
27
+ }, [addAuthorAffiliation]);
30
28
  const options = affiliationsOptions(affiliations, authorAffiliations);
31
29
  const active = authorAffiliations
32
30
  ? authorAffiliations.map((item) => item.data)
@@ -0,0 +1,5 @@
1
+ export * from './CommentBody';
2
+ export * from './CommentTarget';
3
+ export * from './CommentUser';
4
+ export * from './ResolveButton';
5
+ export * from './CommentWrapper';
@@ -0,0 +1,121 @@
1
+ import 'react-modern-calendar-datepicker/lib/DatePicker.css';
2
+ import { add, format, intervalToDuration } from 'date-fns';
3
+ import React, { useCallback, useMemo, useState } from 'react';
4
+ import DatePicker from 'react-modern-calendar-datepicker';
5
+ import styled from 'styled-components';
6
+ import { Category, Dialog, MessageContainer } from '../Dialog';
7
+ const calendarGetDay = (date) => ({
8
+ year: date.getFullYear(),
9
+ month: date.getMonth() + 1,
10
+ day: date.getDate(),
11
+ });
12
+ const calendarPotentialDueDate = (stepDueDate, dueDate, submissionDueDate) => {
13
+ const duration = intervalToDuration({
14
+ start: stepDueDate,
15
+ end: new Date(`${dueDate.year}-${dueDate.month < 10 ? `0${dueDate.month}` : dueDate.month}-${dueDate.day < 10 ? `0${dueDate.day}` : dueDate.day}`),
16
+ });
17
+ return add(submissionDueDate, duration);
18
+ };
19
+ const calendarDatePickerDefaultDateFormat = 'd MMM, EEEE';
20
+ const CalendarDatePicker = ({ Button, handleDateChange, originalDueDate, currentDueDate, datePickerConfigs, dialogConfigs, primaryButtonTitle = 'Reschedule', secondaryButtonTitle = 'Cancel', }) => {
21
+ datePickerConfigs = Object.assign({ position: 'bottom', color: '#f2fbfc', selectedDayClassName: 'selected-day', calendarClassName: 'responsive-calendar' }, datePickerConfigs);
22
+ const dialog = Object.assign({}, dialogConfigs, {
23
+ header: 'Change the task due date?',
24
+ });
25
+ const [dueDate, setDueDate] = useState();
26
+ const [toggleDialog, setToggleDialog] = useState(false);
27
+ const onConfirmClick = useCallback(() => {
28
+ handleDateChange(dueDate);
29
+ setToggleDialog(false);
30
+ }, [dueDate, setToggleDialog, handleDateChange]);
31
+ const formattedDueDate = useMemo(() => dueDate &&
32
+ format(new Date(dueDate.year, dueDate.month, dueDate.day), calendarDatePickerDefaultDateFormat), [dueDate]);
33
+ const formattedPotentialDueDate = useMemo(() => dueDate &&
34
+ format(calendarPotentialDueDate(currentDueDate, dueDate, originalDueDate), calendarDatePickerDefaultDateFormat), [originalDueDate, currentDueDate, dueDate]);
35
+ const onDatePickerChange = useCallback((date) => {
36
+ setDueDate(date);
37
+ setToggleDialog(true);
38
+ const button = document.querySelector('.DatePicker button');
39
+ button.blur();
40
+ }, []);
41
+ return (React.createElement(React.Fragment, null,
42
+ React.createElement(Calendar, null,
43
+ React.createElement(DatePicker, { value: calendarGetDay(currentDueDate), onChange: onDatePickerChange, calendarPopperPosition: datePickerConfigs.position, colorPrimary: datePickerConfigs.color, calendarSelectedDayClassName: datePickerConfigs.selectedDayClassName, calendarClassName: datePickerConfigs.calendarClassName, renderInput: Button })),
44
+ React.createElement(Dialog, { isOpen: toggleDialog, category: Category.confirmation, header: dialog.header, message: React.createElement(React.Fragment, null,
45
+ React.createElement(UpdatedDueDate, null, formattedDueDate),
46
+ dialog.dueDateMessage && (React.createElement(DueDateMessage, null, dialog.dueDateMessage)),
47
+ React.createElement(Value, null,
48
+ React.createElement(StrikeDueDate, { as: 'del' }, format(originalDueDate, calendarDatePickerDefaultDateFormat)),
49
+ formattedPotentialDueDate)), actions: {
50
+ primary: {
51
+ action: onConfirmClick,
52
+ title: primaryButtonTitle,
53
+ },
54
+ secondary: {
55
+ action: () => setToggleDialog(false),
56
+ title: secondaryButtonTitle,
57
+ },
58
+ } })));
59
+ };
60
+ const StrikeDueDate = styled(MessageContainer) `
61
+ margin: 0;
62
+ min-height: min-content;
63
+ padding-right: ${(props) => props.theme.grid.unit}px;
64
+ `;
65
+ const Value = styled.div `
66
+ flex: 1;
67
+ display: flex;
68
+ color: ${(props) => props.theme.colors.text.primary};
69
+ align-items: center;
70
+ line-height: 1;
71
+ `;
72
+ const Calendar = styled.div `
73
+ flex: 1;
74
+
75
+ .DatePicker {
76
+ width: 100%;
77
+ }
78
+
79
+ .DatePicker__calendarContainer {
80
+ position: absolute;
81
+ top: unset;
82
+ left: unset !important;
83
+ right: 0 !important;
84
+ transform: unset !important;
85
+ }
86
+
87
+ .Calendar__weekDay {
88
+ color: #e6e6e6;
89
+ font-size: ${(props) => props.theme.font.size.normal};
90
+ line-height: ${(props) => props.theme.font.lineHeight.large};
91
+ font-weight: ${(props) => props.theme.font.weight.medium};
92
+ }
93
+
94
+ .Calendar__day:not(.-blank):not(.-selected):hover {
95
+ background: #f2fbfc !important;
96
+ }
97
+
98
+ .Calendar__day.-today:hover::after {
99
+ opacity: 0.5 !important;
100
+ }
101
+
102
+ .selected-day {
103
+ color: ${(props) => props.theme.colors.text.primary} !important;
104
+ border: 1px solid ${(props) => props.theme.colors.border.primary} !important;
105
+ }
106
+ `;
107
+ const UpdatedDueDate = styled.div `
108
+ background: ${(props) => props.theme.colors.background.secondary};
109
+ color: ${(props) => props.theme.colors.text.primary};
110
+ width: max-content;
111
+ border: 1px solid ${(props) => props.theme.colors.border.secondary};
112
+ box-sizing: border-box;
113
+ border-radius: ${(props) => props.theme.grid.unit}px;
114
+ padding: ${(props) => props.theme.grid.unit}px
115
+ ${(props) => props.theme.grid.unit * 2}px;
116
+ `;
117
+ const DueDateMessage = styled(MessageContainer) `
118
+ min-height: min-content;
119
+ margin: ${(props) => props.theme.grid.unit * 6}px 0 0 0;
120
+ `;
121
+ export { calendarGetDay, calendarPotentialDueDate, calendarDatePickerDefaultDateFormat, CalendarDatePicker, };
@@ -0,0 +1 @@
1
+ export * from './CalendarDatePicker';
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import ArrowDownUp from '@manuscripts/assets/react/ArrowDownUp';
17
- import { Title } from '@manuscripts/title-editor';
18
17
  import React from 'react';
19
18
  import { NavLink } from 'react-router-dom';
20
19
  import styled, { css } from 'styled-components';
@@ -43,9 +42,6 @@ export const NavDropdown = styled.div `
43
42
  position: absolute;
44
43
  z-index: 10;
45
44
  `;
46
- export const PlaceholderTitle = styled(Title) `
47
- color: ${(props) => props.theme.colors.text.secondary};
48
- `;
49
45
  export const InvitedBy = styled.div `
50
46
  display: flex;
51
47
  align-items: center;
@@ -68,8 +64,7 @@ const commonStyles = css `
68
64
  : props.theme.colors.text.primary};
69
65
  pointer-events: ${(props) => (props.disabled ? 'none' : 'unset')};
70
66
 
71
- &:hover,
72
- &:hover ${PlaceholderTitle} {
67
+ &:hover {
73
68
  background: ${(props) => props.theme.colors.background.fifth};
74
69
  }
75
70
  `;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import React from 'react';
17
- export const PlusIcon = () => (React.createElement("svg", { width: "11", height: "10", viewBox: "0 0 11 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
18
- React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 0.5C5.25147 0.5 5.05 0.701472 5.05 0.95V4.55H1.45C1.20147 4.55 1 4.75147 1 5C1 5.24853 1.20147 5.45 1.45 5.45H5.05V9.05C5.05 9.29853 5.25147 9.5 5.5 9.5C5.74853 9.5 5.95 9.29853 5.95 9.05V5.45H9.55C9.79853 5.45 10 5.24853 10 5C10 4.75147 9.79853 4.55 9.55 4.55H5.95V0.95C5.95 0.701472 5.74853 0.5 5.5 0.5Z", fill: "#6E6E6E" }),
19
- React.createElement("path", { d: "M5.05 4.55V5.05H5.55V4.55H5.05ZM5.05 5.45H5.55V4.95H5.05V5.45ZM5.95 5.45V4.95H5.45V5.45H5.95ZM5.95 4.55H5.45V5.05H5.95V4.55ZM5.55 0.95C5.55 0.977614 5.52761 1 5.5 1V0C4.97533 0 4.55 0.425329 4.55 0.95H5.55ZM5.55 4.55V0.95H4.55V4.55H5.55ZM1.45 5.05H5.05V4.05H1.45V5.05ZM1.5 5C1.5 5.02761 1.47761 5.05 1.45 5.05V4.05C0.925329 4.05 0.5 4.47533 0.5 5H1.5ZM1.45 4.95C1.47761 4.95 1.5 4.97239 1.5 5H0.5C0.5 5.52467 0.925328 5.95 1.45 5.95V4.95ZM5.05 4.95H1.45V5.95H5.05V4.95ZM5.55 9.05V5.45H4.55V9.05H5.55ZM5.5 9C5.52761 9 5.55 9.02239 5.55 9.05H4.55C4.55 9.57467 4.97533 10 5.5 10V9ZM5.45 9.05C5.45 9.02239 5.47239 9 5.5 9V10C6.02467 10 6.45 9.57467 6.45 9.05H5.45ZM5.45 5.45V9.05H6.45V5.45H5.45ZM9.55 4.95H5.95V5.95H9.55V4.95ZM9.5 5C9.5 4.97239 9.52238 4.95 9.55 4.95V5.95C10.0747 5.95 10.5 5.52467 10.5 5H9.5ZM9.55 5.05C9.52239 5.05 9.5 5.02761 9.5 5H10.5C10.5 4.47533 10.0747 4.05 9.55 4.05V5.05ZM5.95 5.05H9.55V4.05H5.95V5.05ZM5.45 0.95V4.55H6.45V0.95H5.45ZM5.5 1C5.47239 1 5.45 0.977615 5.45 0.95H6.45C6.45 0.425329 6.02467 0 5.5 0V1Z", fill: "#6E6E6E" })));
17
+ export const PlusIcon = ({ width = 11, height = 10, viewBox = '0 0 11 10', color = '#6E6E6E', transform, }) => (React.createElement("svg", { width: width, height: height, viewBox: viewBox, fill: "none", xmlns: "http://www.w3.org/2000/svg", transform: transform },
18
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 0.5C5.25147 0.5 5.05 0.701472 5.05 0.95V4.55H1.45C1.20147 4.55 1 4.75147 1 5C1 5.24853 1.20147 5.45 1.45 5.45H5.05V9.05C5.05 9.29853 5.25147 9.5 5.5 9.5C5.74853 9.5 5.95 9.29853 5.95 9.05V5.45H9.55C9.79853 5.45 10 5.24853 10 5C10 4.75147 9.79853 4.55 9.55 4.55H5.95V0.95C5.95 0.701472 5.74853 0.5 5.5 0.5Z", fill: color }),
19
+ React.createElement("path", { d: "M5.05 4.55V5.05H5.55V4.55H5.05ZM5.05 5.45H5.55V4.95H5.05V5.45ZM5.95 5.45V4.95H5.45V5.45H5.95ZM5.95 4.55H5.45V5.05H5.95V4.55ZM5.55 0.95C5.55 0.977614 5.52761 1 5.5 1V0C4.97533 0 4.55 0.425329 4.55 0.95H5.55ZM5.55 4.55V0.95H4.55V4.55H5.55ZM1.45 5.05H5.05V4.05H1.45V5.05ZM1.5 5C1.5 5.02761 1.47761 5.05 1.45 5.05V4.05C0.925329 4.05 0.5 4.47533 0.5 5H1.5ZM1.45 4.95C1.47761 4.95 1.5 4.97239 1.5 5H0.5C0.5 5.52467 0.925328 5.95 1.45 5.95V4.95ZM5.05 4.95H1.45V5.95H5.05V4.95ZM5.55 9.05V5.45H4.55V9.05H5.55ZM5.5 9C5.52761 9 5.55 9.02239 5.55 9.05H4.55C4.55 9.57467 4.97533 10 5.5 10V9ZM5.45 9.05C5.45 9.02239 5.47239 9 5.5 9V10C6.02467 10 6.45 9.57467 6.45 9.05H5.45ZM5.45 5.45V9.05H6.45V5.45H5.45ZM9.55 4.95H5.95V5.95H9.55V4.95ZM9.5 5C9.5 4.97239 9.52238 4.95 9.55 4.95V5.95C10.0747 5.95 10.5 5.52467 10.5 5H9.5ZM9.55 5.05C9.52239 5.05 9.5 5.02761 9.5 5H10.5C10.5 4.47533 10.0747 4.05 9.55 4.05V5.05ZM5.95 5.05H9.55V4.05H5.95V5.05ZM5.45 0.95V4.55H6.45V0.95H5.45ZM5.5 1C5.47239 1 5.45 0.977615 5.45 0.95H6.45C6.45 0.425329 6.02467 0 5.5 0V1Z", fill: color })));
20
20
  export default PlusIcon;
package/dist/es/index.js CHANGED
@@ -45,15 +45,20 @@ export * from './components/Inspector';
45
45
  export * from './components/InspectorSection';
46
46
  export * from './components/Badge';
47
47
  export * from './components/NavDropdown';
48
- export * from './components/SubmissionInspector';
49
48
  export * from './components/Dropdown';
49
+ export * from './components/LoadingOverlay';
50
+ export * from './components/EditorHeader/EditorHeader';
51
+ export * from './components/DatePicker';
52
+ export * from './components/Text';
53
+ export * from './components/ManuscriptNoteList';
54
+ export * from './components/Comments';
55
+ export * from './components/RelativeDate';
50
56
  export * from './hooks/use-dropdown';
51
57
  export * from './hooks/use-files';
52
58
  export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
53
59
  export * from './lib/authors';
54
60
  export * from './lib/capabilities';
55
61
  export * from './lib/files';
62
+ export * from './lib/comments';
56
63
  export { default as errorsDecoder } from './lib/errors-decoder';
57
64
  export * from './types';
58
- export * from './components/LoadingOverlay';
59
- export * from './components/EditorHeader/EditorHeader';
@@ -0,0 +1,5 @@
1
+ export * from './CommentBody';
2
+ export * from './CommentTarget';
3
+ export * from './CommentUser';
4
+ export * from './ResolveButton';
5
+ export * from './CommentWrapper';
@@ -0,0 +1,32 @@
1
+ import 'react-modern-calendar-datepicker/lib/DatePicker.css';
2
+ import React from 'react';
3
+ import { Day, DayValue, RenderInputProps } from 'react-modern-calendar-datepicker';
4
+ declare const calendarGetDay: (date: Date) => {
5
+ year: number;
6
+ month: number;
7
+ day: number;
8
+ };
9
+ declare const calendarPotentialDueDate: (stepDueDate: Date, dueDate: Day, submissionDueDate: Date) => Date;
10
+ declare const calendarDatePickerDefaultDateFormat = "d MMM, EEEE";
11
+ type CalendarDatePickerConfigs = {
12
+ color?: string;
13
+ position?: 'auto' | 'top' | 'bottom';
14
+ calendarClassName?: string;
15
+ selectedDayClassName?: string;
16
+ };
17
+ type CalendarDialogConfigs = {
18
+ header?: string;
19
+ dueDateMessage?: string;
20
+ };
21
+ type CalendarDatePickerProps = {
22
+ currentDueDate: Date;
23
+ originalDueDate: Date;
24
+ handleDateChange: (day: DayValue) => void;
25
+ datePickerConfigs?: CalendarDatePickerConfigs;
26
+ dialogConfigs?: CalendarDialogConfigs;
27
+ Button: React.FC<RenderInputProps>;
28
+ primaryButtonTitle?: string;
29
+ secondaryButtonTitle?: string;
30
+ };
31
+ declare const CalendarDatePicker: React.FC<CalendarDatePickerProps>;
32
+ export { Day as CalendarDay, DayValue as CalendarDayValue, RenderInputProps as CalendarRenderInputProps, calendarGetDay, calendarPotentialDueDate, calendarDatePickerDefaultDateFormat, CalendarDatePickerConfigs, CalendarDialogConfigs, CalendarDatePickerProps, CalendarDatePicker, };
@@ -0,0 +1 @@
1
+ export * from './CalendarDatePicker';
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Title } from '@manuscripts/title-editor';
17
16
  import React from 'react';
18
17
  import { NavLink } from 'react-router-dom';
19
18
  export declare const NavDropdownContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -22,7 +21,6 @@ export declare const NavDropdown: import("styled-components").StyledComponent<"d
22
21
  minWidth?: number | undefined;
23
22
  top?: number | undefined;
24
23
  }, never>;
25
- export declare const PlaceholderTitle: import("styled-components").StyledComponent<typeof Title, import("styled-components").DefaultTheme, {}, never>;
26
24
  export declare const InvitedBy: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
27
25
  export declare const NavDropdownLink: import("styled-components").StyledComponent<typeof NavLink, import("styled-components").DefaultTheme, {
28
26
  disabled?: boolean | undefined;
@@ -13,5 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const PlusIcon: () => JSX.Element;
16
+ import React from 'react';
17
+ import { IconProps } from './types';
18
+ export declare const PlusIcon: React.FC<IconProps>;
17
19
  export default PlusIcon;
@@ -20,4 +20,6 @@ export interface IconProps {
20
20
  title?: string;
21
21
  transform?: string;
22
22
  viewBox?: string;
23
+ width?: number;
24
+ height?: number;
23
25
  }
@@ -46,15 +46,20 @@ export * from './components/Inspector';
46
46
  export * from './components/InspectorSection';
47
47
  export * from './components/Badge';
48
48
  export * from './components/NavDropdown';
49
- export * from './components/SubmissionInspector';
50
49
  export * from './components/Dropdown';
50
+ export * from './components/LoadingOverlay';
51
+ export * from './components/EditorHeader/EditorHeader';
52
+ export * from './components/DatePicker';
53
+ export * from './components/Text';
54
+ export * from './components/ManuscriptNoteList';
55
+ export * from './components/Comments';
56
+ export * from './components/RelativeDate';
51
57
  export * from './hooks/use-dropdown';
52
58
  export * from './hooks/use-files';
53
59
  export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
54
60
  export * from './lib/authors';
55
61
  export * from './lib/capabilities';
56
62
  export * from './lib/files';
63
+ export * from './lib/comments';
57
64
  export { default as errorsDecoder } from './lib/errors-decoder';
58
65
  export * from './types';
59
- export * from './components/LoadingOverlay';
60
- export * from './components/EditorHeader/EditorHeader';
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.4.3",
4
+ "version": "1.4.5-LEAN-3019",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -36,9 +36,8 @@
36
36
  "@formatjs/intl-relativetimeformat": "^4.5.9",
37
37
  "@formatjs/intl-utils": "^2.2.0",
38
38
  "@manuscripts/assets": "^0.6.2",
39
- "@manuscripts/transform": "1.5.2",
40
- "@manuscripts/json-schema": "^2.1.2",
41
- "@manuscripts/title-editor": "^1.1.0",
39
+ "@manuscripts/transform": "1.5.4",
40
+ "@manuscripts/json-schema": "2.2.1",
42
41
  "@reach/tabs": "^0.11.2",
43
42
  "formik": "^2.2.9",
44
43
  "date-fns": "^2.29.3",