@manuscripts/style-guide 1.7.4-LEAN-3160-0 → 1.7.4-LEAN-3160-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.
|
@@ -82,7 +82,7 @@ const AddNewFootnote = (0, styled_components_1.default)(Button_1.ButtonGroup) `
|
|
|
82
82
|
const TableFootnotesEditor = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
83
83
|
const [selections, setSelections] = (0, react_1.useState)(new Map());
|
|
84
84
|
const toggleSelection = (item) => {
|
|
85
|
-
const id = item.
|
|
85
|
+
const id = item.attrs.id;
|
|
86
86
|
if (selections.has(id)) {
|
|
87
87
|
selections.delete(id);
|
|
88
88
|
setSelections(new Map([...selections]));
|
|
@@ -93,7 +93,7 @@ const TableFootnotesEditor = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
const isSelected = (item) => {
|
|
96
|
-
return selections.has(item.
|
|
96
|
+
return selections.has(item.attrs.id);
|
|
97
97
|
};
|
|
98
98
|
const handleClick = () => {
|
|
99
99
|
const items = Array.from(selections.values());
|
|
@@ -113,9 +113,12 @@ const TableFootnotesEditor = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
113
113
|
};
|
|
114
114
|
exports.TableFootnotesEditor = TableFootnotesEditor;
|
|
115
115
|
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
116
|
-
return (react_1.default.createElement(NotesListContainer, null, notes.map((note) =>
|
|
117
|
-
|
|
118
|
-
react_1.default.createElement(
|
|
116
|
+
return (react_1.default.createElement(NotesListContainer, null, notes.map((note) => {
|
|
117
|
+
var _a;
|
|
118
|
+
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(note), key: note.attrs.id },
|
|
119
|
+
react_1.default.createElement(StatusIcon, null, isSelected(note) ? (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 }))),
|
|
120
|
+
react_1.default.createElement(NoteText, null, (_a = note.firstChild) === null || _a === void 0 ? void 0 : _a.textContent)));
|
|
121
|
+
})));
|
|
119
122
|
};
|
|
120
123
|
const NotesListContainer = styled_components_1.default.div `
|
|
121
124
|
padding: 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
@@ -126,10 +129,6 @@ const FootnoteItem = styled_components_1.default.div `
|
|
|
126
129
|
cursor: pointer;
|
|
127
130
|
padding: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
128
131
|
display: flex;
|
|
129
|
-
|
|
130
|
-
&:not(:last-of-type) {
|
|
131
|
-
border-bottom: 1px solid #f6f6f6;
|
|
132
|
-
}
|
|
133
132
|
`;
|
|
134
133
|
const StatusIcon = styled_components_1.default.div `
|
|
135
134
|
flex-shrink: 1;
|
|
@@ -53,7 +53,7 @@ const AddNewFootnote = styled(ButtonGroup) `
|
|
|
53
53
|
export const TableFootnotesEditor = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
54
54
|
const [selections, setSelections] = useState(new Map());
|
|
55
55
|
const toggleSelection = (item) => {
|
|
56
|
-
const id = item.
|
|
56
|
+
const id = item.attrs.id;
|
|
57
57
|
if (selections.has(id)) {
|
|
58
58
|
selections.delete(id);
|
|
59
59
|
setSelections(new Map([...selections]));
|
|
@@ -64,7 +64,7 @@ export const TableFootnotesEditor = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
const isSelected = (item) => {
|
|
67
|
-
return selections.has(item.
|
|
67
|
+
return selections.has(item.attrs.id);
|
|
68
68
|
};
|
|
69
69
|
const handleClick = () => {
|
|
70
70
|
const items = Array.from(selections.values());
|
|
@@ -83,9 +83,12 @@ export const TableFootnotesEditor = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
83
83
|
React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
|
|
84
84
|
};
|
|
85
85
|
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
86
|
-
return (React.createElement(NotesListContainer, null, notes.map((note) =>
|
|
87
|
-
|
|
88
|
-
React.createElement(
|
|
86
|
+
return (React.createElement(NotesListContainer, null, notes.map((note) => {
|
|
87
|
+
var _a;
|
|
88
|
+
return (React.createElement(FootnoteItem, { onClick: () => onSelect(note), key: note.attrs.id },
|
|
89
|
+
React.createElement(StatusIcon, null, isSelected(note) ? (React.createElement(AddedIcon, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (React.createElement(AddIcon, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
90
|
+
React.createElement(NoteText, null, (_a = note.firstChild) === null || _a === void 0 ? void 0 : _a.textContent)));
|
|
91
|
+
})));
|
|
89
92
|
};
|
|
90
93
|
const NotesListContainer = styled.div `
|
|
91
94
|
padding: 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
@@ -96,10 +99,6 @@ const FootnoteItem = styled.div `
|
|
|
96
99
|
cursor: pointer;
|
|
97
100
|
padding: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
98
101
|
display: flex;
|
|
99
|
-
|
|
100
|
-
&:not(:last-of-type) {
|
|
101
|
-
border-bottom: 1px solid #f6f6f6;
|
|
102
|
-
}
|
|
103
102
|
`;
|
|
104
103
|
const StatusIcon = styled.div `
|
|
105
104
|
flex-shrink: 1;
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { FootnoteNode } from '@manuscripts/transform';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
export declare const TableFootnotesEditor: React.FC<{
|
|
19
|
-
notes:
|
|
19
|
+
notes: FootnoteNode[];
|
|
20
20
|
onAdd: () => void;
|
|
21
|
-
onInsert: (notes:
|
|
21
|
+
onInsert: (notes: FootnoteNode[]) => void;
|
|
22
22
|
onCancel: () => void;
|
|
23
23
|
}>;
|
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.7.4-LEAN-3160-
|
|
4
|
+
"version": "1.7.4-LEAN-3160-1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|