@manuscripts/style-guide 1.8.4-LEAN-3144-4 → 1.8.4-LEAN-3344-1
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.
|
@@ -79,14 +79,8 @@ const AddNewFootnote = (0, styled_components_1.default)(Button_1.ButtonGroup) `
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
`;
|
|
82
|
-
const TableFootnotesSelector = ({ notes,
|
|
83
|
-
|
|
84
|
-
if (inlineFootnote) {
|
|
85
|
-
const rids = inlineFootnote.attrs.rids;
|
|
86
|
-
const selectedNotes = notes.filter(({ node }) => rids.includes(node.attrs.id));
|
|
87
|
-
selectedNotesMap = new Map(selectedNotes.map(({ node }) => [node.attrs.id, node]));
|
|
88
|
-
}
|
|
89
|
-
const [selections, setSelections] = (0, react_1.useState)(new Map(selectedNotesMap));
|
|
82
|
+
const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
83
|
+
const [selections, setSelections] = (0, react_1.useState)(new Map());
|
|
90
84
|
const toggleSelection = (item) => {
|
|
91
85
|
const id = item.attrs.id;
|
|
92
86
|
if (selections.has(id)) {
|
|
@@ -106,7 +100,7 @@ const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert, onCanc
|
|
|
106
100
|
};
|
|
107
101
|
return (react_1.default.createElement(Container, null,
|
|
108
102
|
react_1.default.createElement(NotesContainer, null,
|
|
109
|
-
react_1.default.createElement(TableFootnotesList, { notes: notes,
|
|
103
|
+
react_1.default.createElement(TableFootnotesList, { notes: notes, isSelected: isSelected, onSelect: toggleSelection })),
|
|
110
104
|
react_1.default.createElement(Actions, null,
|
|
111
105
|
react_1.default.createElement(AddNewFootnote, null,
|
|
112
106
|
react_1.default.createElement(Button_1.IconTextButton, { onClick: onAdd },
|
|
@@ -114,38 +108,17 @@ const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert, onCanc
|
|
|
114
108
|
"Add new")),
|
|
115
109
|
react_1.default.createElement(Button_1.ButtonGroup, null,
|
|
116
110
|
react_1.default.createElement(Button_1.SecondaryButton, { onClick: onCancel }, "Cancel"),
|
|
117
|
-
react_1.default.createElement(Button_1.PrimaryButton, { onClick: handleClick, disabled: selections.size === 0
|
|
111
|
+
react_1.default.createElement(Button_1.PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
|
|
118
112
|
};
|
|
119
113
|
exports.TableFootnotesSelector = TableFootnotesSelector;
|
|
120
|
-
const TableFootnotesList = ({ notes, isSelected, onSelect
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
remainingNotes.push(note);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
return (react_1.default.createElement(NotesListContainer, null,
|
|
133
|
-
selectedNotes.map((note) => footnoteItem(note, isSelected, onSelect)),
|
|
134
|
-
selectedNotes.length > 0 && remainingNotes.length > 0 && react_1.default.createElement(Separator, null),
|
|
135
|
-
remainingNotes.map((note) => footnoteItem(note, isSelected, onSelect))));
|
|
136
|
-
};
|
|
137
|
-
const footnoteItem = (note, isSelected, onSelect) => {
|
|
138
|
-
var _a;
|
|
139
|
-
const { node, index } = note;
|
|
140
|
-
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
141
|
-
react_1.default.createElement(StatusIcon, null, isSelected(node) ? (react_1.default.createElement(AddedIcon_1.default, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (react_1.default.createElement(AddIcon_1.default, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
142
|
-
react_1.default.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
114
|
+
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
115
|
+
return (react_1.default.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
116
|
+
var _a;
|
|
117
|
+
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
118
|
+
react_1.default.createElement(StatusIcon, null, isSelected(node) ? (react_1.default.createElement(AddedIcon_1.default, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (react_1.default.createElement(AddIcon_1.default, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
119
|
+
react_1.default.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
120
|
+
})));
|
|
143
121
|
};
|
|
144
|
-
const Separator = styled_components_1.default.div `
|
|
145
|
-
height: 0;
|
|
146
|
-
border-bottom: 1px solid #e2e2e2;
|
|
147
|
-
margin: 4px 0;
|
|
148
|
-
`;
|
|
149
122
|
const NotesListContainer = styled_components_1.default.div `
|
|
150
123
|
padding: ${(props) => props.theme.grid.unit * 6}px
|
|
151
124
|
${(props) => props.theme.grid.unit * 5}px;
|
|
@@ -50,14 +50,8 @@ const AddNewFootnote = styled(ButtonGroup) `
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
|
-
export const TableFootnotesSelector = ({ notes,
|
|
54
|
-
|
|
55
|
-
if (inlineFootnote) {
|
|
56
|
-
const rids = inlineFootnote.attrs.rids;
|
|
57
|
-
const selectedNotes = notes.filter(({ node }) => rids.includes(node.attrs.id));
|
|
58
|
-
selectedNotesMap = new Map(selectedNotes.map(({ node }) => [node.attrs.id, node]));
|
|
59
|
-
}
|
|
60
|
-
const [selections, setSelections] = useState(new Map(selectedNotesMap));
|
|
53
|
+
export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
54
|
+
const [selections, setSelections] = useState(new Map());
|
|
61
55
|
const toggleSelection = (item) => {
|
|
62
56
|
const id = item.attrs.id;
|
|
63
57
|
if (selections.has(id)) {
|
|
@@ -77,7 +71,7 @@ export const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert,
|
|
|
77
71
|
};
|
|
78
72
|
return (React.createElement(Container, null,
|
|
79
73
|
React.createElement(NotesContainer, null,
|
|
80
|
-
React.createElement(TableFootnotesList, { notes: notes,
|
|
74
|
+
React.createElement(TableFootnotesList, { notes: notes, isSelected: isSelected, onSelect: toggleSelection })),
|
|
81
75
|
React.createElement(Actions, null,
|
|
82
76
|
React.createElement(AddNewFootnote, null,
|
|
83
77
|
React.createElement(IconTextButton, { onClick: onAdd },
|
|
@@ -85,37 +79,16 @@ export const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert,
|
|
|
85
79
|
"Add new")),
|
|
86
80
|
React.createElement(ButtonGroup, null,
|
|
87
81
|
React.createElement(SecondaryButton, { onClick: onCancel }, "Cancel"),
|
|
88
|
-
React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0
|
|
89
|
-
};
|
|
90
|
-
const TableFootnotesList = ({ notes, isSelected, onSelect, inlineFootnote }) => {
|
|
91
|
-
const selectedNotes = [];
|
|
92
|
-
const remainingNotes = [];
|
|
93
|
-
notes.forEach((note) => {
|
|
94
|
-
const isNoteSelected = inlineFootnote && inlineFootnote.attrs.rids.includes(note.node.attrs.id);
|
|
95
|
-
if (isNoteSelected) {
|
|
96
|
-
selectedNotes.push(note);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
remainingNotes.push(note);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return (React.createElement(NotesListContainer, null,
|
|
103
|
-
selectedNotes.map((note) => footnoteItem(note, isSelected, onSelect)),
|
|
104
|
-
selectedNotes.length > 0 && remainingNotes.length > 0 && React.createElement(Separator, null),
|
|
105
|
-
remainingNotes.map((note) => footnoteItem(note, isSelected, onSelect))));
|
|
82
|
+
React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
|
|
106
83
|
};
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
84
|
+
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
85
|
+
return (React.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
86
|
+
var _a;
|
|
87
|
+
return (React.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
88
|
+
React.createElement(StatusIcon, null, isSelected(node) ? (React.createElement(AddedIcon, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (React.createElement(AddIcon, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
89
|
+
React.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
90
|
+
})));
|
|
113
91
|
};
|
|
114
|
-
const Separator = styled.div `
|
|
115
|
-
height: 0;
|
|
116
|
-
border-bottom: 1px solid #e2e2e2;
|
|
117
|
-
margin: 4px 0;
|
|
118
|
-
`;
|
|
119
92
|
const NotesListContainer = styled.div `
|
|
120
93
|
padding: ${(props) => props.theme.grid.unit * 6}px
|
|
121
94
|
${(props) => props.theme.grid.unit * 5}px;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { FootnoteNode
|
|
16
|
+
import { FootnoteNode } from '@manuscripts/transform';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
export type FootnoteWithIndex = {
|
|
19
19
|
node: FootnoteNode;
|
|
@@ -21,7 +21,6 @@ export type FootnoteWithIndex = {
|
|
|
21
21
|
};
|
|
22
22
|
export declare const TableFootnotesSelector: React.FC<{
|
|
23
23
|
notes: FootnoteWithIndex[];
|
|
24
|
-
inlineFootnote?: InlineFootnoteNode;
|
|
25
24
|
onAdd: () => void;
|
|
26
25
|
onInsert: (notes: FootnoteWithIndex[]) => void;
|
|
27
26
|
onCancel: () => void;
|
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.8.4-LEAN-
|
|
4
|
+
"version": "1.8.4-LEAN-3344-1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@manuscripts/assets": "^0.6.4",
|
|
36
36
|
"@manuscripts/json-schema": "^2.2.7",
|
|
37
|
-
"@manuscripts/transform": "^2.1.
|
|
37
|
+
"@manuscripts/transform": "^2.1.11",
|
|
38
38
|
"@reach/tabs": "^0.18.0",
|
|
39
39
|
"date-fns": "^2.29.3",
|
|
40
40
|
"formik": "^2.2.9",
|