@manuscripts/style-guide 1.8.1 → 1.8.2-LEAN-3429-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.
- package/dist/cjs/components/Button.js +12 -1
- package/dist/cjs/components/ContextMenu.js +52 -0
- package/dist/cjs/components/References/CitationEditor.js +1 -4
- package/dist/cjs/components/TableFootnotesSelector.js +5 -6
- package/dist/cjs/index.js +1 -0
- package/dist/es/components/Button.js +11 -0
- package/dist/es/components/ContextMenu.js +45 -0
- package/dist/es/components/References/CitationEditor.js +1 -4
- package/dist/es/components/TableFootnotesSelector.js +5 -6
- package/dist/es/index.js +1 -0
- package/dist/types/components/Button.d.ts +1 -0
- package/dist/types/components/ContextMenu.d.ts +25 -0
- package/dist/types/components/TableFootnotesSelector.d.ts +6 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.ButtonGroup = exports.SecondaryIconButton = exports.RoundIconButton = exports.IconButton = exports.ToggleButtonAlt = exports.ToggleButton = exports.IconTextButton = exports.TertiaryButton = exports.PrimaryButton = exports.SecondaryButton = void 0;
|
|
41
|
+
exports.IconButtonGroup = exports.ButtonGroup = exports.SecondaryIconButton = exports.RoundIconButton = exports.IconButton = exports.ToggleButtonAlt = exports.ToggleButton = exports.IconTextButton = exports.TertiaryButton = exports.PrimaryButton = exports.SecondaryButton = void 0;
|
|
42
42
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
43
43
|
const dangerBtnStyles = (0, styled_components_1.css) `
|
|
44
44
|
${(props) => btnColors(props.theme.colors.button.error.color.default, props.theme.colors.button.error.background.default, props.theme.colors.button.error.border.default, true)}
|
|
@@ -288,3 +288,14 @@ exports.ButtonGroup = styled_components_1.default.div `
|
|
|
288
288
|
margin-left: ${(props) => props.theme.grid.unit}px;
|
|
289
289
|
}
|
|
290
290
|
`;
|
|
291
|
+
exports.IconButtonGroup = styled_components_1.default.div `
|
|
292
|
+
display: flex;
|
|
293
|
+
flex-direction: row;
|
|
294
|
+
justify-content: flex-start;
|
|
295
|
+
align-items: center;
|
|
296
|
+
|
|
297
|
+
button {
|
|
298
|
+
width: 28px;
|
|
299
|
+
height: 28px;
|
|
300
|
+
}
|
|
301
|
+
`;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2024 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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ContextMenu = void 0;
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
24
|
+
const Button_1 = require("./Button");
|
|
25
|
+
const icons_1 = require("./icons");
|
|
26
|
+
const Tooltip_1 = require("./Tooltip");
|
|
27
|
+
const ContextMenuIconButton = (0, styled_components_1.default)(Button_1.IconButton) `
|
|
28
|
+
color: #6e6e6e;
|
|
29
|
+
&:not([disabled]):hover,
|
|
30
|
+
&:not([disabled]):focus {
|
|
31
|
+
color: #363636;
|
|
32
|
+
background-color: #f2f2f2;
|
|
33
|
+
border-color: #f2f2f2;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const ContextMenu = ({ actions }) => {
|
|
37
|
+
const IconSelector = ({ iconName }) => {
|
|
38
|
+
const icons = {
|
|
39
|
+
AddComment: icons_1.AddComment,
|
|
40
|
+
EditIcon: icons_1.EditIcon,
|
|
41
|
+
};
|
|
42
|
+
const Icon = icons[iconName];
|
|
43
|
+
return react_1.default.createElement(Icon, null);
|
|
44
|
+
};
|
|
45
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
46
|
+
react_1.default.createElement(Button_1.IconButtonGroup, null, actions.map((action) => {
|
|
47
|
+
return (react_1.default.createElement(ContextMenuIconButton, { key: action.icon, "data-tooltip-id": action.icon, onClick: action.action },
|
|
48
|
+
react_1.default.createElement(IconSelector, { iconName: action.icon }),
|
|
49
|
+
react_1.default.createElement(Tooltip_1.Tooltip, { id: action.icon, place: "bottom" }, action.label)));
|
|
50
|
+
}))));
|
|
51
|
+
};
|
|
52
|
+
exports.ContextMenu = ContextMenu;
|
|
@@ -34,7 +34,6 @@ const react_1 = __importStar(require("react"));
|
|
|
34
34
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
35
35
|
const Button_1 = require("../Button");
|
|
36
36
|
const Dialog_1 = require("../Dialog");
|
|
37
|
-
const icons_1 = require("../icons");
|
|
38
37
|
const CitationViewer_1 = require("./CitationViewer");
|
|
39
38
|
const ReferenceLine_1 = require("./ReferenceLine");
|
|
40
39
|
const ReferenceSearch_1 = require("./ReferenceSearch");
|
|
@@ -136,9 +135,7 @@ const CitationEditor = ({ query, rids, items, citationCounts, sources, onCite, o
|
|
|
136
135
|
react_1.default.createElement(CloseIconDark_1.default, { className: 'remove-icon' }))))))),
|
|
137
136
|
react_1.default.createElement(ReferencesModal_1.ReferencesModal, { isOpen: editingForm.show, onCancel: () => setEditingForm({ show: false }), items: items, citationCounts: citationCounts, item: editingForm.item, onSave: onSave, onDelete: onDelete }),
|
|
138
137
|
react_1.default.createElement(Actions, null,
|
|
139
|
-
react_1.default.createElement(Button_1.IconTextButton,
|
|
140
|
-
react_1.default.createElement(icons_1.AddComment, null),
|
|
141
|
-
react_1.default.createElement(AddCommentButtonText, null, "Add Comment")),
|
|
138
|
+
react_1.default.createElement(Button_1.IconTextButton, null),
|
|
142
139
|
react_1.default.createElement(Button_1.ButtonGroup, null,
|
|
143
140
|
react_1.default.createElement(Button_1.SecondaryButton, { onClick: onCancel }, "Done"),
|
|
144
141
|
react_1.default.createElement(Button_1.PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
@@ -96,8 +96,7 @@ const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
96
96
|
return selections.has(item.attrs.id);
|
|
97
97
|
};
|
|
98
98
|
const handleClick = () => {
|
|
99
|
-
|
|
100
|
-
return onInsert(items);
|
|
99
|
+
return onInsert(notes.filter(({ node }) => selections.has(node.attrs.id)));
|
|
101
100
|
};
|
|
102
101
|
return (react_1.default.createElement(Container, null,
|
|
103
102
|
react_1.default.createElement(NotesContainer, null,
|
|
@@ -113,11 +112,11 @@ const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
113
112
|
};
|
|
114
113
|
exports.TableFootnotesSelector = TableFootnotesSelector;
|
|
115
114
|
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
116
|
-
return (react_1.default.createElement(NotesListContainer, null, notes.map((
|
|
115
|
+
return (react_1.default.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
117
116
|
var _a;
|
|
118
|
-
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(
|
|
119
|
-
react_1.default.createElement(StatusIcon, null, isSelected(
|
|
120
|
-
react_1.default.createElement(NoteText, null,
|
|
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))));
|
|
121
120
|
})));
|
|
122
121
|
};
|
|
123
122
|
const NotesListContainer = styled_components_1.default.div `
|
package/dist/cjs/index.js
CHANGED
|
@@ -35,6 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
35
|
exports.errorsDecoder = exports.useDeepCompareCallback = exports.useDeepCompareMemo = void 0;
|
|
36
36
|
__exportStar(require("./components/AlertMessage"), exports);
|
|
37
37
|
__exportStar(require("./components/Button"), exports);
|
|
38
|
+
__exportStar(require("./components/ContextMenu"), exports);
|
|
38
39
|
__exportStar(require("./components/RadioButton"), exports);
|
|
39
40
|
__exportStar(require("./components/AutoSaveInput"), exports);
|
|
40
41
|
__exportStar(require("./components/Avatar"), exports);
|
|
@@ -262,3 +262,14 @@ export const ButtonGroup = styled.div `
|
|
|
262
262
|
margin-left: ${(props) => props.theme.grid.unit}px;
|
|
263
263
|
}
|
|
264
264
|
`;
|
|
265
|
+
export const IconButtonGroup = styled.div `
|
|
266
|
+
display: flex;
|
|
267
|
+
flex-direction: row;
|
|
268
|
+
justify-content: flex-start;
|
|
269
|
+
align-items: center;
|
|
270
|
+
|
|
271
|
+
button {
|
|
272
|
+
width: 28px;
|
|
273
|
+
height: 28px;
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 from 'react';
|
|
17
|
+
import styled from 'styled-components';
|
|
18
|
+
import { IconButton, IconButtonGroup } from './Button';
|
|
19
|
+
import { AddComment, EditIcon } from './icons';
|
|
20
|
+
import { Tooltip } from './Tooltip';
|
|
21
|
+
const ContextMenuIconButton = styled(IconButton) `
|
|
22
|
+
color: #6e6e6e;
|
|
23
|
+
&:not([disabled]):hover,
|
|
24
|
+
&:not([disabled]):focus {
|
|
25
|
+
color: #363636;
|
|
26
|
+
background-color: #f2f2f2;
|
|
27
|
+
border-color: #f2f2f2;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
export const ContextMenu = ({ actions }) => {
|
|
31
|
+
const IconSelector = ({ iconName }) => {
|
|
32
|
+
const icons = {
|
|
33
|
+
AddComment: AddComment,
|
|
34
|
+
EditIcon: EditIcon,
|
|
35
|
+
};
|
|
36
|
+
const Icon = icons[iconName];
|
|
37
|
+
return React.createElement(Icon, null);
|
|
38
|
+
};
|
|
39
|
+
return (React.createElement(React.Fragment, null,
|
|
40
|
+
React.createElement(IconButtonGroup, null, actions.map((action) => {
|
|
41
|
+
return (React.createElement(ContextMenuIconButton, { key: action.icon, "data-tooltip-id": action.icon, onClick: action.action },
|
|
42
|
+
React.createElement(IconSelector, { iconName: action.icon }),
|
|
43
|
+
React.createElement(Tooltip, { id: action.icon, place: "bottom" }, action.label)));
|
|
44
|
+
}))));
|
|
45
|
+
};
|
|
@@ -5,7 +5,6 @@ import React, { useMemo, useState } from 'react';
|
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { ButtonGroup, IconButton, IconTextButton, PrimaryButton, SecondaryButton, } from '../Button';
|
|
7
7
|
import { Category, Dialog } from '../Dialog';
|
|
8
|
-
import { AddComment } from '../icons';
|
|
9
8
|
import { CitedItem, CitedItems } from './CitationViewer';
|
|
10
9
|
import { ReferenceLine } from './ReferenceLine';
|
|
11
10
|
import { ReferenceSearch } from './ReferenceSearch';
|
|
@@ -107,9 +106,7 @@ export const CitationEditor = ({ query, rids, items, citationCounts, sources, on
|
|
|
107
106
|
React.createElement(CloseIconDark, { className: 'remove-icon' }))))))),
|
|
108
107
|
React.createElement(ReferencesModal, { isOpen: editingForm.show, onCancel: () => setEditingForm({ show: false }), items: items, citationCounts: citationCounts, item: editingForm.item, onSave: onSave, onDelete: onDelete }),
|
|
109
108
|
React.createElement(Actions, null,
|
|
110
|
-
React.createElement(IconTextButton,
|
|
111
|
-
React.createElement(AddComment, null),
|
|
112
|
-
React.createElement(AddCommentButtonText, null, "Add Comment")),
|
|
109
|
+
React.createElement(IconTextButton, null),
|
|
113
110
|
React.createElement(ButtonGroup, null,
|
|
114
111
|
React.createElement(SecondaryButton, { onClick: onCancel }, "Done"),
|
|
115
112
|
React.createElement(PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
@@ -67,8 +67,7 @@ export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) =>
|
|
|
67
67
|
return selections.has(item.attrs.id);
|
|
68
68
|
};
|
|
69
69
|
const handleClick = () => {
|
|
70
|
-
|
|
71
|
-
return onInsert(items);
|
|
70
|
+
return onInsert(notes.filter(({ node }) => selections.has(node.attrs.id)));
|
|
72
71
|
};
|
|
73
72
|
return (React.createElement(Container, null,
|
|
74
73
|
React.createElement(NotesContainer, null,
|
|
@@ -83,11 +82,11 @@ export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) =>
|
|
|
83
82
|
React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
|
|
84
83
|
};
|
|
85
84
|
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
86
|
-
return (React.createElement(NotesListContainer, null, notes.map((
|
|
85
|
+
return (React.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
87
86
|
var _a;
|
|
88
|
-
return (React.createElement(FootnoteItem, { onClick: () => onSelect(
|
|
89
|
-
React.createElement(StatusIcon, null, isSelected(
|
|
90
|
-
React.createElement(NoteText, null,
|
|
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))));
|
|
91
90
|
})));
|
|
92
91
|
};
|
|
93
92
|
const NotesListContainer = styled.div `
|
package/dist/es/index.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export * from './components/AlertMessage';
|
|
17
17
|
export * from './components/Button';
|
|
18
|
+
export * from './components/ContextMenu';
|
|
18
19
|
export * from './components/RadioButton';
|
|
19
20
|
export * from './components/AutoSaveInput';
|
|
20
21
|
export * from './components/Avatar';
|
|
@@ -95,3 +95,4 @@ export declare const SecondaryIconButton: import("styled-components").StyledComp
|
|
|
95
95
|
iconColor?: string | undefined;
|
|
96
96
|
}, "type">;
|
|
97
97
|
export declare const ButtonGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
98
|
+
export declare const IconButtonGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 from 'react';
|
|
17
|
+
export interface Actions {
|
|
18
|
+
label: string;
|
|
19
|
+
action: () => void;
|
|
20
|
+
icon: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ContextMenuProps {
|
|
23
|
+
actions: Actions[];
|
|
24
|
+
}
|
|
25
|
+
export declare const ContextMenu: React.FC<ContextMenuProps>;
|
|
@@ -15,9 +15,13 @@
|
|
|
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
|
+
};
|
|
18
22
|
export declare const TableFootnotesSelector: React.FC<{
|
|
19
|
-
notes:
|
|
23
|
+
notes: FootnoteWithIndex[];
|
|
20
24
|
onAdd: () => void;
|
|
21
|
-
onInsert: (notes:
|
|
25
|
+
onInsert: (notes: FootnoteWithIndex[]) => void;
|
|
22
26
|
onCancel: () => void;
|
|
23
27
|
}>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export { Theme } from './theme';
|
|
17
17
|
export * from './components/AlertMessage';
|
|
18
18
|
export * from './components/Button';
|
|
19
|
+
export * from './components/ContextMenu';
|
|
19
20
|
export * from './components/RadioButton';
|
|
20
21
|
export * from './components/AutoSaveInput';
|
|
21
22
|
export * from './components/Avatar';
|
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
|
+
"version": "1.8.2-LEAN-3429-0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -103,4 +103,4 @@
|
|
|
103
103
|
"@types/react": "^17.0.2",
|
|
104
104
|
"jackspeak": "2.1.1"
|
|
105
105
|
}
|
|
106
|
-
}
|
|
106
|
+
}
|