@manuscripts/style-guide 1.7.10 → 1.7.11-LEAN-3415-3

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.
@@ -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, { onClick: onComment },
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")))));
package/dist/cjs/index.js CHANGED
@@ -39,6 +39,7 @@ __exportStar(require("./components/AuthorName"), exports);
39
39
  __exportStar(require("./components/AuthorsDND"), exports);
40
40
  __exportStar(require("./components/AlertMessage"), exports);
41
41
  __exportStar(require("./components/Button"), exports);
42
+ __exportStar(require("./components/ContextMenu"), exports);
42
43
  __exportStar(require("./components/RadioButton"), exports);
43
44
  __exportStar(require("./components/AutoSaveInput"), exports);
44
45
  __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, { onClick: onComment },
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")))));
package/dist/es/index.js CHANGED
@@ -19,6 +19,7 @@ export * from './components/AuthorName';
19
19
  export * from './components/AuthorsDND';
20
20
  export * from './components/AlertMessage';
21
21
  export * from './components/Button';
22
+ export * from './components/ContextMenu';
22
23
  export * from './components/RadioButton';
23
24
  export * from './components/AutoSaveInput';
24
25
  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>;
@@ -20,6 +20,7 @@ export * from './components/AuthorName';
20
20
  export * from './components/AuthorsDND';
21
21
  export * from './components/AlertMessage';
22
22
  export * from './components/Button';
23
+ export * from './components/ContextMenu';
23
24
  export * from './components/RadioButton';
24
25
  export * from './components/AutoSaveInput';
25
26
  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.7.10",
4
+ "version": "1.7.11-LEAN-3415-3",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@manuscripts/assets": "^0.6.4",
36
- "@manuscripts/json-schema": "^2.2.5",
37
- "@manuscripts/transform": "^2.1.5",
36
+ "@manuscripts/json-schema": "^2.2.6",
37
+ "@manuscripts/transform": "^2.1.6",
38
38
  "@reach/tabs": "^0.18.0",
39
39
  "date-fns": "^2.29.3",
40
40
  "formik": "^2.2.9",