@manuscripts/style-guide 1.6.2 → 1.7.0

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 (67) hide show
  1. package/dist/cjs/components/Dialog.js +3 -3
  2. package/dist/cjs/components/References/BibliographyItemSource.js +91 -0
  3. package/dist/cjs/components/References/CitationEditor.js +146 -0
  4. package/dist/cjs/components/References/CitationViewer.js +69 -0
  5. package/dist/cjs/components/References/ReferenceForm.js +415 -0
  6. package/dist/cjs/components/References/ReferenceLine.js +52 -0
  7. package/dist/cjs/components/References/ReferenceSearch.js +124 -0
  8. package/dist/cjs/components/References/ReferenceSearchResults.js +68 -0
  9. package/dist/cjs/components/References/ReferenceSearchResultsPlaceholder.js +43 -0
  10. package/dist/cjs/components/References/ReferenceSearchSection.js +118 -0
  11. package/dist/cjs/components/References/ReferencesModal.js +219 -0
  12. package/dist/cjs/components/References/SearchInput.js +103 -0
  13. package/dist/cjs/components/References/index.js +20 -0
  14. package/dist/cjs/components/SelectField.js +25 -0
  15. package/dist/cjs/components/Sidebar.js +44 -0
  16. package/dist/cjs/components/StyledModal.js +80 -3
  17. package/dist/cjs/components/icons/delete-icon.js +15 -0
  18. package/dist/cjs/components/icons/link-icon.js +11 -0
  19. package/dist/cjs/components/icons/template-icon.js +11 -0
  20. package/dist/cjs/hooks/use-scroll-detection.js +53 -0
  21. package/dist/cjs/index.js +1 -1
  22. package/dist/es/components/Dialog.js +2 -2
  23. package/dist/es/components/References/BibliographyItemSource.js +64 -0
  24. package/dist/es/components/References/CitationEditor.js +116 -0
  25. package/dist/es/components/References/CitationViewer.js +39 -0
  26. package/dist/es/components/References/ReferenceForm.js +385 -0
  27. package/dist/es/components/References/ReferenceLine.js +42 -0
  28. package/dist/es/components/References/ReferenceSearch.js +94 -0
  29. package/dist/es/components/References/ReferenceSearchResults.js +61 -0
  30. package/dist/es/components/References/ReferenceSearchResultsPlaceholder.js +36 -0
  31. package/dist/es/components/References/ReferenceSearchSection.js +88 -0
  32. package/dist/es/components/References/ReferencesModal.js +188 -0
  33. package/dist/es/components/References/SearchInput.js +73 -0
  34. package/dist/es/components/References/index.js +4 -0
  35. package/dist/es/components/SelectField.js +18 -0
  36. package/dist/es/components/Sidebar.js +18 -0
  37. package/dist/es/components/StyledModal.js +81 -3
  38. package/dist/es/components/icons/delete-icon.js +8 -0
  39. package/dist/es/components/icons/link-icon.js +4 -0
  40. package/dist/es/components/icons/template-icon.js +4 -0
  41. package/dist/es/hooks/use-scroll-detection.js +49 -0
  42. package/dist/es/index.js +1 -1
  43. package/dist/types/components/Dialog.d.ts +1 -1
  44. package/dist/types/components/References/BibliographyItemSource.d.ts +38 -0
  45. package/dist/types/components/References/CitationEditor.d.ts +18 -0
  46. package/dist/types/components/References/CitationViewer.d.ts +24 -0
  47. package/dist/types/components/References/ReferenceForm.d.ts +35 -0
  48. package/dist/types/components/References/ReferenceLine.d.ts +10 -0
  49. package/dist/types/components/References/ReferenceSearch.d.ts +26 -0
  50. package/dist/types/components/References/ReferenceSearchResults.d.ts +26 -0
  51. package/dist/types/components/References/ReferenceSearchResultsPlaceholder.d.ts +2 -0
  52. package/dist/types/components/References/ReferenceSearchSection.d.ts +25 -0
  53. package/dist/types/components/References/ReferencesModal.d.ts +14 -0
  54. package/dist/types/components/References/SearchInput.d.ts +18 -0
  55. package/dist/types/components/References/index.d.ts +4 -0
  56. package/dist/types/components/SelectField.d.ts +27 -0
  57. package/dist/types/components/Sidebar.d.ts +2 -0
  58. package/dist/types/components/StyledModal.d.ts +26 -4
  59. package/dist/types/components/icons/delete-icon.d.ts +2 -0
  60. package/dist/types/components/icons/link-icon.d.ts +2 -0
  61. package/dist/types/components/icons/template-icon.d.ts +2 -0
  62. package/dist/types/hooks/use-scroll-detection.d.ts +22 -0
  63. package/dist/types/index.d.ts +1 -1
  64. package/package.json +3 -2
  65. package/dist/cjs/components/SimpleModal.js +0 -95
  66. package/dist/es/components/SimpleModal.js +0 -88
  67. package/dist/types/components/SimpleModal.d.ts +0 -41
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DeleteIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const DeleteIcon = () => (react_1.default.createElement("svg", { width: "13", height: "16", viewBox: "0 0 13 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
9
+ react_1.default.createElement("path", { className: "icon_element", fillRule: "evenodd", clipRule: "evenodd", d: "M2.00001 2.99995C2 3.0013 2 3.00265 2 3.00399V13.004C2 13.5563 2.44772 14.004 3 14.004H10C10.5523 14.004 11 13.5563 11 13.004V3.00399C11 3.00265 11 3.0013 11 2.99995C11.5978 3.34576 12 3.99211 12 4.73239V13.004C12 14.1086 11.1046 15.004 10 15.004H3C1.89543 15.004 1 14.1086 1 13.004V4.73239C1 3.99211 1.4022 3.34576 2.00001 2.99995Z", fill: "#F35143" }),
10
+ react_1.default.createElement("path", { className: "icon_element", fillRule: "evenodd", clipRule: "evenodd", d: "M4.5 0C3.67157 0 3 0.671573 3 1.5V3.5C3 4.32843 3.67157 5 4.5 5H8.5C9.32843 5 10 4.32843 10 3.5V1.5C10 0.671573 9.32843 0 8.5 0H4.5ZM9 1.5C9 1.22386 8.77614 1 8.5 1H4.5C4.22386 1 4 1.22386 4 1.5C4 1.77614 4.22386 2 4.5 2H8.5C8.77614 2 9 1.77614 9 1.5Z", fill: "#F35143" }),
11
+ react_1.default.createElement("rect", { className: "icon_element", y: "2", width: "13", height: "3", rx: "1.5", fill: "#F35143" }),
12
+ react_1.default.createElement("path", { className: "icon_element", fillRule: "evenodd", clipRule: "evenodd", d: "M8 7.5C8 7.22386 8.22386 7 8.5 7C8.77614 7 9 7.22386 9 7.5V11.5C9 11.7761 8.77614 12 8.5 12C8.22386 12 8 11.7761 8 11.5V7.5Z", fill: "#F35143" }),
13
+ react_1.default.createElement("path", { className: "icon_element", fillRule: "evenodd", clipRule: "evenodd", d: "M4 7.5C4 7.22386 4.22386 7 4.5 7C4.77614 7 5 7.22386 5 7.5V11.5C5 11.7761 4.77614 12 4.5 12C4.22386 12 4 11.7761 4 11.5V7.5Z", fill: "#F35143" }),
14
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.5 3C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4L1.5 4C1.22386 4 1 3.77614 1 3.5C1 3.22386 1.22386 3 1.5 3L11.5 3Z", fill: "white" })));
15
+ exports.DeleteIcon = DeleteIcon;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LinkIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const LinkIcon = () => (react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
9
+ react_1.default.createElement("path", { d: "M6.63317 12.1949L4.74782 14.0803C3.9662 14.8619 2.70042 14.8619 1.91945 14.0804C1.13832 13.2993 1.13832 12.0334 1.91929 11.2524L5.69063 7.48109C6.4716 6.70009 7.73751 6.70009 8.51848 7.48109C8.77882 7.74143 9.20095 7.74143 9.46129 7.48109C9.72163 7.22075 9.72163 6.79862 9.46129 6.53828C8.1596 5.23659 6.04951 5.23659 4.74782 6.53828L0.97651 10.3096C-0.325178 11.6113 -0.325178 13.7214 0.97651 15.0231C2.27804 16.3254 4.38829 16.3254 5.69067 15.0231L7.57601 13.1377C7.83635 12.8774 7.83635 12.4552 7.57601 12.1949C7.31567 11.9346 6.89351 11.9346 6.63317 12.1949Z", fill: "#6E6E6E" }),
10
+ react_1.default.createElement("path", { d: "M15.0235 0.976266C13.7218 -0.325422 11.6111 -0.325422 10.3094 0.976266L8.04737 3.23827C7.78702 3.49861 7.78702 3.92073 8.04737 4.18108C8.30771 4.44142 8.72984 4.44142 8.99018 4.18108L11.2522 1.91908C12.0331 1.13808 13.2997 1.13808 14.0807 1.91908C14.8617 2.70005 14.8617 3.96595 14.0807 4.74692L9.93271 8.89495C9.15171 9.67595 7.88584 9.67595 7.10487 8.89495C6.84452 8.63461 6.4224 8.63461 6.16205 8.89495C5.90171 9.1553 5.90171 9.57742 6.16205 9.83777C7.46374 11.1395 9.57384 11.1395 10.8755 9.83777L15.0235 5.68977C16.3252 4.38808 16.3252 2.27795 15.0235 0.976266Z", fill: "#6E6E6E" })));
11
+ exports.LinkIcon = LinkIcon;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TemplateIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const TemplateIcon = () => (react_1.default.createElement("svg", { width: "16", height: "18", viewBox: "0 0 16 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
9
+ react_1.default.createElement("rect", { x: "1.25", y: "1.25", width: "13.5", height: "15.5", rx: "1.75", fill: "white", stroke: "#6E6E6E", strokeWidth: "1.5" }),
10
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 6.5C9 6.08579 8.66421 5.75 8.25 5.75H7.25V4.75C7.25 4.33579 6.91421 4 6.5 4C6.08579 4 5.75 4.33579 5.75 4.75V5.75H4.75C4.33579 5.75 4 6.08579 4 6.5C4 6.91421 4.33579 7.25 4.75 7.25H5.75V8.25C5.75 8.66421 6.08579 9 6.5 9C6.91421 9 7.25 8.66421 7.25 8.25V7.25H8.25C8.66421 7.25 9 6.91421 9 6.5Z", fill: "#6E6E6E" })));
11
+ exports.TemplateIcon = TemplateIcon;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2023 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.useScrollDetection = void 0;
19
+ const react_1 = require("react");
20
+ const useScrollDetection = (topTrigger, bottomTrigger) => {
21
+ const refRoot = (0, react_1.useRef)();
22
+ const observer = (0, react_1.useRef)();
23
+ const [triggers, setTriggers] = (0, react_1.useState)({ bottom: false, top: false });
24
+ const ref = (node) => {
25
+ if (!node) {
26
+ return;
27
+ }
28
+ refRoot.current = node;
29
+ if (refRoot.current && !observer.current) {
30
+ const listener = () => {
31
+ if (!refRoot.current) {
32
+ return;
33
+ }
34
+ const node = refRoot.current;
35
+ if (node.scrollTop == 0) {
36
+ node.scrollTop = 1;
37
+ }
38
+ const topRatio = node.scrollTop / node.offsetHeight;
39
+ const bottomRatio = 1 -
40
+ (node.scrollHeight - node.offsetHeight - node.scrollTop) /
41
+ node.offsetHeight;
42
+ const newVal = { top: false, bottom: false };
43
+ newVal.top = topRatio <= topTrigger;
44
+ newVal.bottom = Math.round(bottomRatio * 100) / 100 >= bottomTrigger;
45
+ setTriggers(newVal);
46
+ };
47
+ refRoot.current.addEventListener('scroll', listener);
48
+ observer.current = listener;
49
+ }
50
+ };
51
+ return { ref, triggers };
52
+ };
53
+ exports.useScrollDetection = useScrollDetection;
package/dist/cjs/index.js CHANGED
@@ -53,7 +53,6 @@ __exportStar(require("./components/FileManager"), exports);
53
53
  __exportStar(require("./components/FileManager/util"), exports);
54
54
  __exportStar(require("./components/Resizer"), exports);
55
55
  __exportStar(require("./components/SaveStatus"), exports);
56
- __exportStar(require("./components/SimpleModal"), exports);
57
56
  __exportStar(require("./components/StyledModal"), exports);
58
57
  __exportStar(require("./components/TextField"), exports);
59
58
  __exportStar(require("./components/TextFieldContainer"), exports);
@@ -73,6 +72,7 @@ __exportStar(require("./components/Text"), exports);
73
72
  __exportStar(require("./components/ManuscriptNoteList"), exports);
74
73
  __exportStar(require("./components/Comments"), exports);
75
74
  __exportStar(require("./components/RelativeDate"), exports);
75
+ __exportStar(require("./components/References"), exports);
76
76
  __exportStar(require("./components/Menus"), exports);
77
77
  __exportStar(require("./hooks/use-dropdown"), exports);
78
78
  __exportStar(require("./hooks/use-files"), exports);
@@ -34,7 +34,7 @@ const Icon = styled.div `
34
34
  display: inline-flex;
35
35
  align-items: center;
36
36
  `;
37
- export const ModalBody = styled.div `
37
+ export const DialogModalBody = styled.div `
38
38
  border-radius: ${(props) => props.theme.grid.radius.default};
39
39
  box-shadow: ${(props) => props.theme.shadow.dropShadow};
40
40
  background: ${(props) => props.theme.colors.background.primary};
@@ -115,7 +115,7 @@ export class Dialog extends React.Component {
115
115
  const { actions, isOpen, header, message, category, children, confirmFieldText, className, } = this.props;
116
116
  const { primaryActionDisabled } = this.state;
117
117
  return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: actions.onClose, shouldCloseOnOverlayClick: true, className: className },
118
- React.createElement(ModalBody, null,
118
+ React.createElement(DialogModalBody, null,
119
119
  React.createElement(HeaderContainer, null,
120
120
  category === Category.error && (React.createElement(Icon, null,
121
121
  React.createElement(AttentionRed, null))),
@@ -0,0 +1,64 @@
1
+ /*!
2
+ * © 2023 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import * as fuzzysort from 'fuzzysort';
17
+ const newestFirst = (a, b) => {
18
+ if (a.createdAt === b.createdAt) {
19
+ return 0;
20
+ }
21
+ if (!a.createdAt) {
22
+ return -1;
23
+ }
24
+ if (!b.createdAt) {
25
+ return 1;
26
+ }
27
+ return b.createdAt - a.createdAt;
28
+ };
29
+ export class DocumentReferenceSource {
30
+ constructor(items) {
31
+ this.id = 'document';
32
+ this.label = 'Document';
33
+ this.items = items;
34
+ }
35
+ search(query, limit) {
36
+ if (!query) {
37
+ return {
38
+ response: Promise.resolve({
39
+ items: [...this.items].sort(newestFirst).slice(0, limit),
40
+ total: this.items.length,
41
+ }),
42
+ };
43
+ }
44
+ const index = [...this.items].sort(newestFirst).map((i) => {
45
+ var _a;
46
+ return {
47
+ item: i,
48
+ title: i.title,
49
+ authors: (_a = i.author) === null || _a === void 0 ? void 0 : _a.map((a) => `${a.given} ${a.family}`).join(', '),
50
+ };
51
+ });
52
+ const results = fuzzysort.go(query, index, {
53
+ keys: ['title', 'authors'],
54
+ limit: limit,
55
+ threshold: -1000,
56
+ });
57
+ return {
58
+ response: Promise.resolve({
59
+ items: results.map((r) => r.obj.item),
60
+ total: results.total,
61
+ }),
62
+ };
63
+ }
64
+ }
@@ -0,0 +1,116 @@
1
+ import AnnotationEdit from '@manuscripts/assets/react/AnnotationEdit';
2
+ import CloseIconDark from '@manuscripts/assets/react/CloseIconDark';
3
+ import { buildBibliographyItem } from '@manuscripts/transform';
4
+ import React, { useMemo, useState } from 'react';
5
+ import styled from 'styled-components';
6
+ import { ButtonGroup, IconButton, IconTextButton, PrimaryButton, SecondaryButton, } from '../Button';
7
+ import { Category, Dialog } from '../Dialog';
8
+ import { AddComment } from '../icons';
9
+ import { CitedItem, CitedItems } from './CitationViewer';
10
+ import { ReferenceLine } from './ReferenceLine';
11
+ import { ReferenceSearch } from './ReferenceSearch';
12
+ import { ReferencesModal } from './ReferencesModal';
13
+ const AddCommentButtonText = styled.div `
14
+ display: contents;
15
+ font-family: ${(props) => props.theme.font.family.sans};
16
+ font-weight: ${(props) => props.theme.font.weight.normal};
17
+ font-size: ${(props) => props.theme.font.size.small};
18
+ line-height: ${(props) => props.theme.font.lineHeight.large};
19
+ color: ${(props) => props.theme.colors.text.primary};
20
+ `;
21
+ const CitedItemActions = styled.div `
22
+ display: flex;
23
+ align-items: center;
24
+ margin-left: 12px;
25
+
26
+ svg.remove-icon {
27
+ height: ${(props) => props.theme.grid.unit * 4}px;
28
+ width: ${(props) => props.theme.grid.unit * 4}px;
29
+ }
30
+ `;
31
+ const ActionButton = styled(IconButton).attrs({
32
+ size: 24,
33
+ }) `
34
+ :disabled {
35
+ background-color: transparent !important;
36
+ border-color: transparent !important;
37
+ color: rgb(255, 255, 255);
38
+ path,
39
+ g {
40
+ fill: ${(props) => props.theme.colors.background.tertiary} !important;
41
+ }
42
+ }
43
+ :not(:disabled):focus,
44
+ :not(:disabled):hover {
45
+ path,
46
+ g {
47
+ fill: ${(props) => props.theme.colors.brand.medium} !important;
48
+ }
49
+ }
50
+ `;
51
+ const EditReferenceButton = styled(ActionButton) `
52
+ margin-right: ${(props) => props.theme.grid.unit * 3}px;
53
+ `;
54
+ const Actions = styled.div `
55
+ margin: ${(props) => props.theme.grid.unit * 4}px;
56
+ display: flex;
57
+ justify-content: space-between;
58
+ align-items: center;
59
+ `;
60
+ export const CitationEditor = ({ query, rids, items, citationCounts, sources, onCite, onUncite, onSave, onDelete, onComment, onCancel, canEdit, }) => {
61
+ const [deleteDialog, setDeleteDialog] = useState({ show: false });
62
+ const [editingForm, setEditingForm] = useState({
63
+ show: false,
64
+ });
65
+ const [searching, setSearching] = useState(false);
66
+ const handleAdd = () => {
67
+ setSearching(false);
68
+ const item = buildBibliographyItem({});
69
+ onSave(item);
70
+ onCite([item]);
71
+ setEditingForm({ show: true, item: item });
72
+ };
73
+ const cited = useMemo(() => {
74
+ return rids.flatMap((rid) => items.filter((i) => i._id === rid));
75
+ }, [rids, items]);
76
+ if (searching) {
77
+ return (React.createElement(ReferenceSearch, { sources: sources, items: items, onAdd: handleAdd, onCite: (items) => {
78
+ setSearching(false);
79
+ onCite(items);
80
+ }, onCancel: () => setSearching(false) }));
81
+ }
82
+ if (!rids.length) {
83
+ return (React.createElement(ReferenceSearch, { query: query, sources: sources, items: items, onAdd: handleAdd, onCite: onCite, onCancel: onCancel }));
84
+ }
85
+ return (React.createElement(React.Fragment, null,
86
+ React.createElement(Dialog, { isOpen: deleteDialog.show, category: Category.confirmation, header: "Remove cited item", message: "Are you sure you want to remove this cited item? It will still exist in the reference list.", actions: {
87
+ secondary: {
88
+ action: () => {
89
+ if (deleteDialog.id) {
90
+ onUncite(deleteDialog.id);
91
+ setDeleteDialog({ show: false });
92
+ }
93
+ },
94
+ title: 'Remove',
95
+ },
96
+ primary: {
97
+ action: () => setDeleteDialog({ show: false }),
98
+ title: 'Cancel',
99
+ },
100
+ } }),
101
+ React.createElement(CitedItems, null, cited.map((item) => (React.createElement(CitedItem, { key: item._id },
102
+ React.createElement(ReferenceLine, { item: item }),
103
+ React.createElement(CitedItemActions, null,
104
+ React.createElement(EditReferenceButton, { value: item._id, disabled: !canEdit, onClick: () => setEditingForm({ show: true, item: item }) },
105
+ React.createElement(AnnotationEdit, { color: '#6E6E6E' })),
106
+ React.createElement(ActionButton, { disabled: !canEdit, onClick: () => setDeleteDialog({ show: true, id: item._id }) },
107
+ React.createElement(CloseIconDark, { className: 'remove-icon' }))))))),
108
+ React.createElement(ReferencesModal, { isOpen: editingForm.show, onCancel: () => setEditingForm({ show: false }), items: items, citationCounts: citationCounts, item: editingForm.item, onSave: onSave, onDelete: onDelete }),
109
+ React.createElement(Actions, null,
110
+ React.createElement(IconTextButton, { onClick: onComment },
111
+ React.createElement(AddComment, null),
112
+ React.createElement(AddCommentButtonText, null, "Add Comment")),
113
+ React.createElement(ButtonGroup, null,
114
+ React.createElement(SecondaryButton, { onClick: onCancel }, "Done"),
115
+ React.createElement(PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
116
+ };
@@ -0,0 +1,39 @@
1
+ /*!
2
+ * © 2024 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import React, { useMemo } from 'react';
17
+ import styled from 'styled-components';
18
+ import { ReferenceLine } from './ReferenceLine';
19
+ export const CitedItems = styled.div `
20
+ padding: 0 ${(props) => props.theme.grid.unit * 4}px;
21
+ font-family: ${(props) => props.theme.font.family.sans};
22
+ max-height: 70vh;
23
+ min-height: 100px;
24
+ overflow-y: auto;
25
+ `;
26
+ export const CitedItem = styled.div `
27
+ display: flex;
28
+ padding: ${(props) => props.theme.grid.unit * 4}px 0;
29
+
30
+ &:not(:last-of-type) {
31
+ border-bottom: 1px solid ${(props) => props.theme.colors.border.secondary};
32
+ }
33
+ `;
34
+ export const CitationViewer = ({ rids, items, }) => {
35
+ const cited = useMemo(() => {
36
+ return rids.flatMap((rid) => items.filter((i) => i._id === rid));
37
+ }, [rids, items]);
38
+ return (React.createElement(CitedItems, null, cited.map((item) => (React.createElement(ReferenceLine, { key: item._id, item: item })))));
39
+ };