@manuscripts/style-guide 1.8.2-LEAN-3429-0 → 1.8.2-LEAN-3321-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.
@@ -96,7 +96,8 @@ const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
96
96
  return selections.has(item.attrs.id);
97
97
  };
98
98
  const handleClick = () => {
99
- return onInsert(notes.filter(({ node }) => selections.has(node.attrs.id)));
99
+ const items = Array.from(selections.values());
100
+ return onInsert(items);
100
101
  };
101
102
  return (react_1.default.createElement(Container, null,
102
103
  react_1.default.createElement(NotesContainer, null,
@@ -112,11 +113,11 @@ const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
112
113
  };
113
114
  exports.TableFootnotesSelector = TableFootnotesSelector;
114
115
  const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
115
- return (react_1.default.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
116
+ return (react_1.default.createElement(NotesListContainer, null, notes.map((note, index) => {
116
117
  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))));
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, ++index + '. ' + ((_a = note.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
120
121
  })));
121
122
  };
122
123
  const NotesListContainer = styled_components_1.default.div `
@@ -67,7 +67,8 @@ export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) =>
67
67
  return selections.has(item.attrs.id);
68
68
  };
69
69
  const handleClick = () => {
70
- return onInsert(notes.filter(({ node }) => selections.has(node.attrs.id)));
70
+ const items = Array.from(selections.values());
71
+ return onInsert(items);
71
72
  };
72
73
  return (React.createElement(Container, null,
73
74
  React.createElement(NotesContainer, null,
@@ -82,11 +83,11 @@ export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) =>
82
83
  React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
83
84
  };
84
85
  const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
85
- return (React.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
86
+ return (React.createElement(NotesListContainer, null, notes.map((note, index) => {
86
87
  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))));
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, ++index + '. ' + ((_a = note.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
90
91
  })));
91
92
  };
92
93
  const NotesListContainer = styled.div `
@@ -15,13 +15,9 @@
15
15
  */
16
16
  import { FootnoteNode } from '@manuscripts/transform';
17
17
  import React from 'react';
18
- export type FootnoteWithIndex = {
19
- node: FootnoteNode;
20
- index?: string;
21
- };
22
18
  export declare const TableFootnotesSelector: React.FC<{
23
- notes: FootnoteWithIndex[];
19
+ notes: FootnoteNode[];
24
20
  onAdd: () => void;
25
- onInsert: (notes: FootnoteWithIndex[]) => void;
21
+ onInsert: (notes: FootnoteNode[]) => void;
26
22
  onCancel: () => void;
27
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.8.2-LEAN-3429-0",
4
+ "version": "1.8.2-LEAN-3321-0",
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.6",
37
- "@manuscripts/transform": "^2.1.6",
37
+ "@manuscripts/transform": "2.1.9-LEAN-3321",
38
38
  "@reach/tabs": "^0.18.0",
39
39
  "date-fns": "^2.29.3",
40
40
  "formik": "^2.2.9",