@manuscripts/style-guide 1.11.3-LEAN-3514.1 → 1.11.3-LEAN-3526.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 (46) hide show
  1. package/dist/cjs/components/References/BibliographyItemSource.js +91 -0
  2. package/dist/cjs/components/References/CitationEditor.js +142 -0
  3. package/dist/cjs/components/References/CitationViewer.js +69 -0
  4. package/dist/cjs/components/References/ReferenceForm.js +414 -0
  5. package/dist/cjs/components/References/ReferenceLine.js +52 -0
  6. package/dist/cjs/components/References/ReferenceSearch.js +124 -0
  7. package/dist/cjs/components/References/ReferenceSearchResults.js +68 -0
  8. package/dist/cjs/components/References/ReferenceSearchResultsPlaceholder.js +43 -0
  9. package/dist/cjs/components/References/ReferenceSearchSection.js +118 -0
  10. package/dist/cjs/components/References/ReferencesModal.js +226 -0
  11. package/dist/cjs/components/References/SearchInput.js +103 -0
  12. package/dist/cjs/components/References/index.js +20 -0
  13. package/dist/cjs/components/icons/delete-solid-icon.js +10 -0
  14. package/dist/cjs/components/icons/index.js +3 -5
  15. package/dist/cjs/index.js +1 -2
  16. package/dist/es/components/References/BibliographyItemSource.js +64 -0
  17. package/dist/es/components/References/CitationEditor.js +112 -0
  18. package/dist/es/components/References/CitationViewer.js +39 -0
  19. package/dist/es/components/References/ReferenceForm.js +384 -0
  20. package/dist/es/components/References/ReferenceLine.js +42 -0
  21. package/dist/es/components/References/ReferenceSearch.js +94 -0
  22. package/dist/es/components/References/ReferenceSearchResults.js +61 -0
  23. package/dist/es/components/References/ReferenceSearchResultsPlaceholder.js +36 -0
  24. package/dist/es/components/References/ReferenceSearchSection.js +88 -0
  25. package/dist/es/components/References/ReferencesModal.js +195 -0
  26. package/dist/es/components/References/SearchInput.js +73 -0
  27. package/dist/es/components/References/index.js +4 -0
  28. package/dist/es/components/icons/delete-solid-icon.js +3 -0
  29. package/dist/es/components/icons/index.js +1 -2
  30. package/dist/es/index.js +1 -2
  31. package/dist/types/components/References/BibliographyItemSource.d.ts +38 -0
  32. package/dist/types/components/References/CitationEditor.d.ts +18 -0
  33. package/dist/types/components/References/CitationViewer.d.ts +24 -0
  34. package/dist/types/components/References/ReferenceForm.d.ts +35 -0
  35. package/dist/types/components/References/ReferenceLine.d.ts +10 -0
  36. package/dist/types/components/References/ReferenceSearch.d.ts +26 -0
  37. package/dist/types/components/References/ReferenceSearchResults.d.ts +26 -0
  38. package/dist/types/components/References/ReferenceSearchResultsPlaceholder.d.ts +2 -0
  39. package/dist/types/components/References/ReferenceSearchSection.d.ts +25 -0
  40. package/dist/types/components/References/ReferencesModal.d.ts +14 -0
  41. package/dist/types/components/References/SearchInput.d.ts +18 -0
  42. package/dist/types/components/References/index.d.ts +4 -0
  43. package/dist/types/components/icons/delete-solid-icon.d.ts +3 -0
  44. package/dist/types/components/icons/index.d.ts +1 -2
  45. package/dist/types/index.d.ts +1 -2
  46. package/package.json +2 -2
@@ -0,0 +1,61 @@
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 AddedIcon from '@manuscripts/assets/react/AddedIcon';
17
+ import AddIcon from '@manuscripts/assets/react/AddIcon';
18
+ import React from 'react';
19
+ import styled from 'styled-components';
20
+ import { SecondaryButton } from '../Button';
21
+ import { ReferenceLine } from './ReferenceLine';
22
+ const StatusIcon = styled.div `
23
+ flex-shrink: 1;
24
+ margin-right: ${(props) => props.theme.grid.unit * 3}px;
25
+ margin-left: ${(props) => props.theme.grid.unit}px;
26
+ height: ${(props) => props.theme.grid.unit * 6}px;
27
+ width: ${(props) => props.theme.grid.unit * 6}px;
28
+ display: inline-flex;
29
+ justify-content: center;
30
+ align-items: center;
31
+ cursor: pointer;
32
+ `;
33
+ const MoreButton = styled(SecondaryButton) `
34
+ font-size: inherit;
35
+ text-transform: none;
36
+ text-decoration: underline;
37
+ border: none;
38
+ margin-left: ${(props) => props.theme.grid.unit * 4}px;
39
+ color: ${(props) => props.theme.colors.button.default.color.default};
40
+ `;
41
+ export const ReferenceSearchResultsContainer = styled.div `
42
+ padding: 0 ${(props) => props.theme.grid.unit * 4}px;
43
+ flex: 1;
44
+ overflow-y: auto;
45
+ `;
46
+ export const ReferenceSearchResult = styled.div `
47
+ cursor: pointer;
48
+ padding: ${(props) => props.theme.grid.unit * 2}px 0;
49
+ display: flex;
50
+
51
+ &:not(:last-of-type) {
52
+ border-bottom: 1px solid #f6f6f6;
53
+ }
54
+ `;
55
+ export const ReferenceSearchResults = ({ items, total, isSelected, onSelect, onShowMore }) => {
56
+ return (React.createElement(ReferenceSearchResultsContainer, null,
57
+ items.map((item) => (React.createElement(ReferenceSearchResult, { onClick: () => onSelect(item), key: item._id },
58
+ React.createElement(StatusIcon, null, isSelected(item) ? (React.createElement(AddedIcon, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (React.createElement(AddIcon, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
59
+ React.createElement(ReferenceLine, { item: item })))),
60
+ items.length < 25 && total > items.length ? (React.createElement(MoreButton, { onClick: onShowMore, "data-cy": 'more-button' }, "Show more")) : undefined));
61
+ };
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Metadata, MetadataContainer } from './ReferenceLine';
4
+ import { ReferenceSearchResult, ReferenceSearchResultsContainer, } from './ReferenceSearchResults';
5
+ const IconPlaceholderContainer = styled.div `
6
+ width: 36px;
7
+ `;
8
+ const IconPlaceholder = styled.span `
9
+ margin-left: 8px;
10
+ `;
11
+ const MetadataPlaceholder = styled(Metadata) `
12
+ background: ${(props) => props.theme.colors.text.muted};
13
+ height: 1.2em;
14
+ `;
15
+ const TitlePlaceholder = styled.div `
16
+ background: ${(props) => props.theme.colors.border.primary};
17
+ height: 1.2em;
18
+ `;
19
+ const SearchingLabel = styled.div `
20
+ color: ${(props) => props.theme.colors.text.secondary};
21
+ margin-left: ${(props) => props.theme.grid.unit * 9}px;
22
+ `;
23
+ const ReferenceSearchResultPlaceholder = styled(ReferenceSearchResult) `
24
+ opacity: 0.2;
25
+ `;
26
+ const Placeholder = () => (React.createElement(ReferenceSearchResultPlaceholder, null,
27
+ React.createElement(IconPlaceholderContainer, null,
28
+ React.createElement(IconPlaceholder, null, "...")),
29
+ React.createElement(MetadataContainer, null,
30
+ React.createElement(TitlePlaceholder, null),
31
+ React.createElement(MetadataPlaceholder, null))));
32
+ export const ReferenceSearchResultsPlaceholder = () => (React.createElement(ReferenceSearchResultsContainer, null,
33
+ React.createElement(SearchingLabel, null, "Searching"),
34
+ React.createElement(Placeholder, null),
35
+ React.createElement(Placeholder, null),
36
+ React.createElement(Placeholder, null)));
@@ -0,0 +1,88 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ import ArrowDownUp from '@manuscripts/assets/react/ArrowDownUp';
26
+ import React, { useEffect, useState } from 'react';
27
+ import styled from 'styled-components';
28
+ import { ReferenceSearchResults } from './ReferenceSearchResults';
29
+ import { ReferenceSearchResultsPlaceholder } from './ReferenceSearchResultsPlaceholder';
30
+ const SearchSourceLabel = styled.div `
31
+ margin: 0 ${(props) => props.theme.grid.unit * 4}px
32
+ ${(props) => props.theme.grid.unit * 2}px;
33
+ color: ${(props) => props.theme.colors.text.secondary};
34
+ cursor: pointer;
35
+
36
+ &:hover {
37
+ color: ${(props) => props.theme.colors.text.muted};
38
+ }
39
+ `;
40
+ export const Arrow = styled(ArrowDownUp) `
41
+ margin-right: 16px;
42
+ margin-left: 10px;
43
+
44
+ user-select: none;
45
+
46
+ transform: rotate(180deg);
47
+
48
+ &.open {
49
+ transform: rotate(0deg);
50
+ }
51
+ `;
52
+ export const ReferenceSearchSection = ({ query, source, isSelected, onSelect }) => {
53
+ const [expanded, setExpanded] = useState(true);
54
+ const [state, setState] = useState();
55
+ const [limit, setLimit] = useState(3);
56
+ const toggleExpanded = () => {
57
+ setExpanded((value) => !value);
58
+ };
59
+ useEffect(() => {
60
+ const search = () => __awaiter(void 0, void 0, void 0, function* () {
61
+ const job = source.search(query, limit);
62
+ setState((s) => {
63
+ if ((s === null || s === void 0 ? void 0 : s.type) === 'running' && s.job.cancel) {
64
+ s.job.cancel();
65
+ }
66
+ return {
67
+ type: 'running',
68
+ job,
69
+ };
70
+ });
71
+ const response = yield job.response;
72
+ if (job.isCancelled) {
73
+ return;
74
+ }
75
+ setState(Object.assign({ type: 'completed' }, response));
76
+ });
77
+ search();
78
+ }, [source, query, limit]);
79
+ const handleShowMore = () => {
80
+ setLimit(25);
81
+ };
82
+ return (React.createElement(React.Fragment, null,
83
+ React.createElement(SearchSourceLabel, { onClick: toggleExpanded },
84
+ React.createElement(Arrow, { className: expanded ? 'open' : '' }),
85
+ source.label),
86
+ expanded && (state === null || state === void 0 ? void 0 : state.type) === 'running' && (React.createElement(ReferenceSearchResultsPlaceholder, null)),
87
+ expanded && (state === null || state === void 0 ? void 0 : state.type) === 'completed' && (React.createElement(ReferenceSearchResults, { items: state.items, total: state.total, isSelected: isSelected, onSelect: onSelect, onShowMore: handleShowMore }))));
88
+ };
@@ -0,0 +1,195 @@
1
+ import ReferenceLibraryIcon from '@manuscripts/assets/react/ReferenceLibraryIcon';
2
+ import { isEqual } from 'lodash';
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+ import styled from 'styled-components';
5
+ import { useScrollDetection } from '../../hooks/use-scroll-detection';
6
+ import { Category, Dialog } from '../Dialog';
7
+ import { SidebarContent } from '../Sidebar';
8
+ import { CloseButton, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, StyledModal, } from '../StyledModal';
9
+ import { Tooltip } from '../Tooltip';
10
+ import { ReferenceForm, } from './ReferenceForm';
11
+ import { ReferenceLine } from './ReferenceLine';
12
+ const ReferencesModalContainer = styled(ModalContainer) `
13
+ min-width: 960px;
14
+ `;
15
+ const ReferencesSidebar = styled(ModalSidebar) `
16
+ width: 70%;
17
+ `;
18
+ const ReferencesSidebarContent = styled(SidebarContent) `
19
+ overflow-y: auto;
20
+ `;
21
+ const ReferencesInnerWrapper = styled.div `
22
+ width: 100%;
23
+ `;
24
+ const ReferenceButton = styled.div `
25
+ cursor: pointer;
26
+ display: flex;
27
+ justify-content: flex-start;
28
+ padding: ${(props) => props.theme.grid.unit * 4}px 0;
29
+ border-top: 1px solid transparent;
30
+ border-bottom: 1px solid transparent;
31
+
32
+ path {
33
+ fill: #c9c9c9;
34
+ }
35
+
36
+ :hover {
37
+ background: ${(props) => props.theme.colors.background.info};
38
+ }
39
+
40
+ &.selected {
41
+ background: ${(props) => props.theme.colors.background.info};
42
+ border-top-color: #bce7f6;
43
+ border-bottom-color: #bce7f6;
44
+ }
45
+
46
+ .tooltip {
47
+ max-width: ${(props) => props.theme.grid.unit * 25}px;
48
+ padding: ${(props) => props.theme.grid.unit * 2}px;
49
+ border-radius: 6px;
50
+ }
51
+ `;
52
+ const IconContainer = styled.div `
53
+ padding-right: ${(props) => props.theme.grid.unit * 5}px;
54
+ position: relative;
55
+ `;
56
+ const CitationCount = styled.div `
57
+ border-radius: 50%;
58
+ width: 12px;
59
+ height: 12px;
60
+ position: absolute;
61
+ color: #ffffff;
62
+ background-color: #bce7f6;
63
+ text-align: center;
64
+ vertical-align: top;
65
+ top: 0;
66
+ left: 16px;
67
+ font-size: 9px;
68
+
69
+ &.unused {
70
+ background-color: #fe8f1f;
71
+ }
72
+ `;
73
+ const selectionTopOffset = 10;
74
+ const pageSize = 12;
75
+ const topTrigger = 0.2;
76
+ const bottomTrigger = 0.8;
77
+ const dropLimit = 36;
78
+ export const normalize = (item) => ({
79
+ _id: item._id,
80
+ title: item.title || '',
81
+ author: item.author || [],
82
+ DOI: item.DOI || '',
83
+ issued: item.issued,
84
+ type: item.type || '',
85
+ 'container-title': item['container-title'] || '',
86
+ URL: item.URL || '',
87
+ issue: item.issue ? String(item.issue) : '',
88
+ volume: item.volume ? String(item.volume) : '',
89
+ supplement: item.supplement ? String(item.supplement) : '',
90
+ page: item.page ? String(item.page) : '',
91
+ });
92
+ export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave, onDelete, }) => {
93
+ const [confirm, setConfirm] = useState(false);
94
+ const valuesRef = useRef();
95
+ const [selection, setSelection] = useState();
96
+ const selectionRef = useRef(null);
97
+ const isSelected = (item) => {
98
+ return item._id === (selection === null || selection === void 0 ? void 0 : selection._id);
99
+ };
100
+ const selectionIndex = items.findIndex(isSelected);
101
+ useEffect(() => {
102
+ setSelection(item);
103
+ }, [item]);
104
+ useEffect(() => {
105
+ setTimeout(() => {
106
+ var _a;
107
+ (_a = selectionRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
108
+ block: 'center',
109
+ behavior: 'auto',
110
+ });
111
+ }, 100);
112
+ }, [selectionIndex]);
113
+ const { ref, triggers } = useScrollDetection(topTrigger, bottomTrigger);
114
+ const [startIndex, setStartIndex] = useState(Math.max(0, selectionIndex - selectionTopOffset));
115
+ const [endIndex, setEndIndex] = useState(pageSize);
116
+ useEffect(() => {
117
+ const base = Math.max(0, selectionIndex - selectionTopOffset);
118
+ setStartIndex(base);
119
+ setEndIndex(Math.min(items.length - 1, base + pageSize));
120
+ }, [selectionIndex, items]);
121
+ useEffect(() => {
122
+ if (triggers.top) {
123
+ const newFirst = Math.max(0, startIndex - pageSize);
124
+ setStartIndex(newFirst);
125
+ setEndIndex(Math.min(newFirst + dropLimit, endIndex));
126
+ }
127
+ if (triggers.bottom) {
128
+ const newLast = Math.min(items.length - 1, endIndex + pageSize);
129
+ setEndIndex(newLast);
130
+ setStartIndex(Math.max(newLast - dropLimit, startIndex));
131
+ }
132
+ }, [triggers, items]);
133
+ const actionsRef = useRef();
134
+ const reset = () => {
135
+ var _a;
136
+ (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.reset();
137
+ setConfirm(false);
138
+ };
139
+ const save = (values) => {
140
+ if (!values || !selection) {
141
+ return;
142
+ }
143
+ const item = Object.assign(Object.assign({}, selection), values);
144
+ onSave(item);
145
+ setSelection(item);
146
+ setConfirm(false);
147
+ };
148
+ const handleDelete = () => {
149
+ if (!selection) {
150
+ return;
151
+ }
152
+ onDelete(selection);
153
+ setSelection(undefined);
154
+ };
155
+ const handleItemClick = (item) => {
156
+ const values = valuesRef.current;
157
+ if (values && selection && !isEqual(values, normalize(selection))) {
158
+ setConfirm(true);
159
+ return;
160
+ }
161
+ setSelection(item);
162
+ };
163
+ const handleChange = (values) => {
164
+ valuesRef.current = values;
165
+ };
166
+ if (items.length <= 0) {
167
+ return React.createElement(React.Fragment, null);
168
+ }
169
+ return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: onCancel },
170
+ React.createElement(Dialog, { isOpen: confirm, category: Category.confirmation, header: "You've made changes to this option", message: "Would you like to save or discard your changes?", actions: {
171
+ secondary: {
172
+ action: () => reset(),
173
+ title: 'Discard',
174
+ },
175
+ primary: {
176
+ action: () => save(valuesRef.current),
177
+ title: 'Save',
178
+ },
179
+ } }),
180
+ React.createElement(ReferencesModalContainer, null,
181
+ React.createElement(ModalHeader, null,
182
+ React.createElement(CloseButton, { onClick: onCancel })),
183
+ React.createElement(ModalBody, null,
184
+ React.createElement(ReferencesSidebar, null,
185
+ React.createElement(ModalSidebarHeader, null,
186
+ React.createElement(ModalSidebarTitle, null, "References")),
187
+ React.createElement(ReferencesSidebarContent, { ref: ref },
188
+ React.createElement(ReferencesInnerWrapper, null, items.slice(startIndex, endIndex + 1).map((item) => (React.createElement(ReferenceButton, { key: item._id, id: item._id, className: isSelected(item) ? 'selected' : '', onClick: () => handleItemClick(item), ref: isSelected(item) ? selectionRef : null },
189
+ React.createElement(IconContainer, null,
190
+ React.createElement(ReferenceLibraryIcon, null),
191
+ (citationCounts.get(item._id) || 0) > 0 ? (React.createElement(CitationCount, { "data-tooltip-id": "citation-count-tooltip" }, citationCounts.get(item._id))) : (React.createElement(CitationCount, { className: "unused" }, "0"))),
192
+ React.createElement(ReferenceLine, { item: item }))))),
193
+ React.createElement(Tooltip, { id: "citation-count-tooltip", place: "bottom" }, "Number of times used in the document"))),
194
+ React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: handleDelete, onSave: save, actionsRef: actionsRef })))))));
195
+ };
@@ -0,0 +1,73 @@
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 SearchIconNoBGc from '@manuscripts/assets/react/SearchIconNoBG';
17
+ import React, { useState } from 'react';
18
+ import styled from 'styled-components';
19
+ import { TextField } from '../TextField';
20
+ const SearchContainer = styled.div `
21
+ align-items: center;
22
+ display: flex;
23
+ flex: 1 0 auto;
24
+ position: relative;
25
+ margin: 12px;
26
+ `;
27
+ const SearchIconContainer = styled.span `
28
+ display: flex;
29
+ left: ${(props) => props.theme.grid.unit * 4}px;
30
+ position: absolute;
31
+ z-index: 2;
32
+
33
+ path {
34
+ fill: ${(props) => props.theme.colors.text.primary};
35
+ }
36
+
37
+ &.active path {
38
+ fill: ${(props) => props.theme.colors.brand.medium};
39
+ }
40
+ `;
41
+ const SearchTextField = styled(TextField) `
42
+ -webkit-appearance: textfield;
43
+ padding-left: ${(props) => props.theme.grid.unit * 11}px;
44
+ &:hover,
45
+ &:focus {
46
+ background-color: ${(props) => props.theme.colors.background.fifth};
47
+ }
48
+ `;
49
+ export const SearchWrapper = styled.div `
50
+ display: flex;
51
+ align-items: center;
52
+ padding: ${(props) => props.theme.grid.unit * 3}px;
53
+ `;
54
+ export const SearchInput = (props) => {
55
+ const [hover, setHover] = useState(false);
56
+ const [focus, setFocus] = useState(false);
57
+ const onFocus = () => {
58
+ setFocus(true);
59
+ };
60
+ const onBlur = () => {
61
+ setFocus(false);
62
+ };
63
+ const onMouseEnter = () => {
64
+ setHover(true);
65
+ };
66
+ const onMouseLeave = () => {
67
+ setHover(false);
68
+ };
69
+ return (React.createElement(SearchContainer, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur },
70
+ React.createElement(SearchIconContainer, { className: hover || focus ? 'active' : '' },
71
+ React.createElement(SearchIconNoBGc, null)),
72
+ React.createElement(SearchTextField, Object.assign({}, props, { type: "search", placeholder: "Search", autoComplete: "off" }))));
73
+ };
@@ -0,0 +1,4 @@
1
+ export * from './CitationEditor';
2
+ export * from './CitationViewer';
3
+ export * from './ReferencesModal';
4
+ export * from './BibliographyItemSource';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export const DeleteSolidIcon = (props) => (React.createElement("svg", { className: props.className, width: "12", height: "14", viewBox: "0 0 12 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
3
+ React.createElement("path", { d: "M11.494 0.375H7.955C7.93 0.165 7.714 0 7.451 0H4.548C4.286 0 4.07 0.165 4.045 0.375H0.506C0.226 0.375 0 0.561 0 0.792V1.583C0 1.813 0.227 2 0.506 2H11.494C11.774 2 12 1.814 12 1.583V0.792C12 0.562 11.773 0.375 11.494 0.375ZM1 3V13.491C1 13.772 1.23 14 1.513 14H10.487C10.5541 14.0004 10.6207 13.9875 10.6829 13.9621C10.745 13.9367 10.8015 13.8993 10.8492 13.852C10.8969 13.8047 10.9347 13.7485 10.9606 13.6866C10.9865 13.6246 10.9999 13.5581 11 13.491V3H1ZM4.753 10.874C4.753 11.184 4.5 11.435 4.188 11.435C4.03886 11.4355 3.89559 11.3769 3.78966 11.2719C3.68373 11.1669 3.62379 11.0241 3.623 10.875V5.311C3.623 5.001 3.876 4.75 4.188 4.75C4.5 4.75 4.753 5 4.753 5.31V10.873V10.874ZM8.377 10.874C8.377 11.184 8.124 11.435 7.812 11.435C7.66286 11.4355 7.51959 11.3769 7.41366 11.2719C7.30773 11.1669 7.24779 11.0241 7.247 10.875V5.311C7.247 5.001 7.5 4.75 7.812 4.75C8.124 4.75 8.377 5 8.377 5.31V10.873V10.874Z", fill: "#6E6E6E" })));
@@ -46,5 +46,4 @@ export { default as BlockQuoteIcon } from './block-quote-icon';
46
46
  export { default as PullQuoteIcon } from './pull-quote-icon';
47
47
  export { default as PlusIcon } from './plus-icon';
48
48
  export { DeleteIcon } from './delete-icon';
49
- export { LinkIcon } from './link-icon';
50
- export { TemplateIcon } from './template-icon';
49
+ export { DeleteSolidIcon } from './delete-solid-icon';
package/dist/es/index.js CHANGED
@@ -47,12 +47,11 @@ export * from './components/Text';
47
47
  export * from './components/ManuscriptNoteList';
48
48
  export * from './components/Comments';
49
49
  export * from './components/RelativeDate';
50
+ export * from './components/References';
50
51
  export * from './components/Menus';
51
- export * from './components/SelectField';
52
52
  export * from './hooks/use-dropdown';
53
53
  export * from './hooks/use-files';
54
54
  export * from './hooks/use-menus';
55
- export * from './hooks/use-scroll-detection';
56
55
  export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
57
56
  export * from './lib/capabilities';
58
57
  export * from './lib/files';
@@ -0,0 +1,38 @@
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 { BibliographyItem } from '@manuscripts/json-schema';
17
+ export interface BibliographyItemSource {
18
+ id: string;
19
+ label: string;
20
+ search: (query: string, limit: number) => Job<BibliographyItemSearchResponse>;
21
+ find?: () => Job<BibliographyItem>;
22
+ }
23
+ export type Job<T> = {
24
+ response: Promise<T>;
25
+ cancel?: () => void;
26
+ isCancelled?: boolean;
27
+ };
28
+ export type BibliographyItemSearchResponse = {
29
+ items: BibliographyItem[];
30
+ total: number;
31
+ };
32
+ export declare class DocumentReferenceSource implements BibliographyItemSource {
33
+ id: string;
34
+ label: string;
35
+ private items;
36
+ constructor(items: BibliographyItem[]);
37
+ search(query: string, limit: number): Job<BibliographyItemSearchResponse>;
38
+ }
@@ -0,0 +1,18 @@
1
+ import { BibliographyItem } from '@manuscripts/json-schema';
2
+ import React from 'react';
3
+ import { BibliographyItemSource } from './BibliographyItemSource';
4
+ export interface CitationEditorProps {
5
+ query?: string;
6
+ rids: string[];
7
+ items: BibliographyItem[];
8
+ citationCounts: Map<string, number>;
9
+ sources: BibliographyItemSource[];
10
+ onCite: (items: BibliographyItem[]) => void;
11
+ onUncite: (id: string) => void;
12
+ onSave: (item: BibliographyItem) => void;
13
+ onDelete: (item: BibliographyItem) => void;
14
+ onComment: () => void;
15
+ onCancel: () => void;
16
+ canEdit: boolean;
17
+ }
18
+ export declare const CitationEditor: React.FC<CitationEditorProps>;
@@ -0,0 +1,24 @@
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 { BibliographyItem } from '@manuscripts/json-schema';
17
+ import React from 'react';
18
+ export declare const CitedItems: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
19
+ export declare const CitedItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
20
+ export interface CitationViewerProps {
21
+ rids: string[];
22
+ items: BibliographyItem[];
23
+ }
24
+ export declare const CitationViewer: React.FC<CitationViewerProps>;
@@ -0,0 +1,35 @@
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 { BibliographyItem } from '@manuscripts/json-schema';
17
+ import React, { MutableRefObject } from 'react';
18
+ export declare const LabelContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
19
+ export declare const FormField: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
20
+ export declare const ReferenceTextArea: import("styled-components").StyledComponent<"textarea", import("styled-components").DefaultTheme, import("../Form").ErrorProps, never>;
21
+ export declare const FlexForm: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & React.RefAttributes<HTMLFormElement>>, import("styled-components").DefaultTheme, {}, never>;
22
+ export declare const FormFields: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
23
+ export type ReferenceFormValues = Pick<BibliographyItem, '_id' | 'title' | 'author' | 'DOI' | 'issued' | 'type' | 'container-title' | 'URL' | 'issue' | 'volume' | 'supplement' | 'page'>;
24
+ export interface ReferenceFormActions {
25
+ reset: () => void;
26
+ }
27
+ export declare const ReferenceForm: React.FC<{
28
+ values: ReferenceFormValues;
29
+ showDelete: boolean;
30
+ onChange: (values: ReferenceFormValues) => void;
31
+ onCancel: () => void;
32
+ onDelete: () => void;
33
+ onSave: (values: ReferenceFormValues) => void;
34
+ actionsRef?: MutableRefObject<ReferenceFormActions | undefined>;
35
+ }>;
@@ -0,0 +1,10 @@
1
+ import { BibliographyItem } from '@manuscripts/json-schema';
2
+ import React from 'react';
3
+ export declare const Metadata: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
+ export declare const MetadataContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const metadata: (item: BibliographyItem) => string;
6
+ export declare const issuedYear: (item: Partial<BibliographyItem>) => string;
7
+ export declare const authors: (item: BibliographyItem) => string;
8
+ export declare const ReferenceLine: React.FC<{
9
+ item: BibliographyItem;
10
+ }>;
@@ -0,0 +1,26 @@
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 { BibliographyItem } from '@manuscripts/json-schema';
17
+ import React from 'react';
18
+ import { BibliographyItemSource } from './BibliographyItemSource';
19
+ export declare const ReferenceSearch: React.FC<{
20
+ query?: string;
21
+ sources: BibliographyItemSource[];
22
+ items: BibliographyItem[];
23
+ onAdd: () => void;
24
+ onCite: (items: BibliographyItem[]) => void;
25
+ onCancel: () => void;
26
+ }>;