@manuscripts/style-guide 1.7.1 → 1.7.2

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.
Files changed (80) hide show
  1. package/dist/cjs/components/Comments/CommentBody.js +3 -3
  2. package/dist/cjs/components/Comments/CommentUser.js +1 -1
  3. package/dist/cjs/components/Comments/ResolveButton.js +3 -3
  4. package/dist/cjs/components/FileManager/FileCreatedDate.js +3 -3
  5. package/dist/cjs/components/FileManager/FileManager.js +7 -7
  6. package/dist/cjs/components/FileManager/OtherFilesSection.js +2 -2
  7. package/dist/cjs/components/FileManager/SupplementsSection.js +1 -2
  8. package/dist/cjs/components/References/CitationEditor.js +2 -2
  9. package/dist/cjs/components/References/ReferenceForm.js +8 -9
  10. package/dist/cjs/components/References/ReferenceSearch.js +2 -2
  11. package/dist/cjs/components/References/ReferencesModal.js +5 -5
  12. package/dist/cjs/components/RelativeDate.js +23 -6
  13. package/dist/cjs/components/{FileManager/Tooltip.js → Tooltip.js} +12 -7
  14. package/dist/cjs/index.js +1 -2
  15. package/dist/cjs/lib/files.js +4 -5
  16. package/dist/es/components/Comments/CommentBody.js +3 -3
  17. package/dist/es/components/Comments/CommentUser.js +1 -1
  18. package/dist/es/components/Comments/ResolveButton.js +3 -3
  19. package/dist/es/components/FileManager/FileCreatedDate.js +3 -3
  20. package/dist/es/components/FileManager/FileManager.js +7 -7
  21. package/dist/es/components/FileManager/OtherFilesSection.js +2 -2
  22. package/dist/es/components/FileManager/SupplementsSection.js +2 -3
  23. package/dist/es/components/References/CitationEditor.js +1 -1
  24. package/dist/es/components/References/ReferenceForm.js +6 -7
  25. package/dist/es/components/References/ReferenceSearch.js +1 -1
  26. package/dist/es/components/References/ReferencesModal.js +5 -5
  27. package/dist/es/components/RelativeDate.js +23 -6
  28. package/dist/es/components/Tooltip.js +25 -0
  29. package/dist/es/index.js +1 -2
  30. package/dist/es/lib/files.js +1 -2
  31. package/dist/types/components/AlertMessage.d.ts +1 -1
  32. package/dist/types/components/AuthorForm/RemoveAuthorButton.d.ts +1 -1
  33. package/dist/types/components/AutoSaveInput.d.ts +1 -1
  34. package/dist/types/components/Comments/CommentUser.d.ts +2 -3
  35. package/dist/types/components/Dialog.d.ts +1 -1
  36. package/dist/types/components/Dropdown.d.ts +1 -1
  37. package/dist/types/components/EditorHeader/EditorHeader.d.ts +1 -2
  38. package/dist/types/components/FileManager/FileActions.d.ts +1 -1
  39. package/dist/types/components/FileManager/FileManager.d.ts +1 -2
  40. package/dist/types/components/FileManager/util.d.ts +1 -0
  41. package/dist/types/components/Form.d.ts +1 -1
  42. package/dist/types/components/Inspector.d.ts +7 -9
  43. package/dist/types/components/NavDropdown.d.ts +1 -1
  44. package/dist/types/components/References/ReferenceForm.d.ts +1 -1
  45. package/dist/types/components/RelativeDate.d.ts +15 -1
  46. package/dist/types/components/Resizer/Resizer.d.ts +1 -1
  47. package/dist/types/components/Resizer/ResizerButton.d.ts +1 -1
  48. package/dist/types/components/Tooltip.d.ts +5 -0
  49. package/dist/types/components/icons/add-author.d.ts +2 -1
  50. package/dist/types/components/icons/add-comment-icon.d.ts +2 -1
  51. package/dist/types/components/icons/add-icon-active.d.ts +2 -1
  52. package/dist/types/components/icons/add-icon-inverted.d.ts +2 -1
  53. package/dist/types/components/icons/back-arrow.d.ts +2 -1
  54. package/dist/types/components/icons/bookmark.d.ts +2 -1
  55. package/dist/types/components/icons/google.d.ts +2 -1
  56. package/dist/types/components/icons/orcid.d.ts +2 -1
  57. package/dist/types/components/icons/project-notification.d.ts +2 -1
  58. package/dist/types/components/icons/project.d.ts +2 -1
  59. package/dist/types/components/icons/projects-list.d.ts +2 -1
  60. package/dist/types/components/icons/search.d.ts +2 -1
  61. package/dist/types/components/icons/tick-mark.d.ts +2 -1
  62. package/dist/types/components/icons/user.d.ts +2 -1
  63. package/dist/types/index.d.ts +1 -2
  64. package/dist/types/lib/capabilities.d.ts +3 -4
  65. package/package.json +30 -41
  66. package/dist/cjs/components/ColorField/ColorField.js +0 -49
  67. package/dist/cjs/components/ColorField/ColorSelector.js +0 -115
  68. package/dist/cjs/components/ColorField/index.js +0 -32
  69. package/dist/cjs/components/Tip.js +0 -83
  70. package/dist/es/components/ColorField/ColorField.js +0 -42
  71. package/dist/es/components/ColorField/ColorSelector.js +0 -85
  72. package/dist/es/components/ColorField/index.js +0 -16
  73. package/dist/es/components/FileManager/Tooltip.js +0 -20
  74. package/dist/es/components/Tip.js +0 -53
  75. package/dist/types/components/ColorField/ColorField.d.ts +0 -27
  76. package/dist/types/components/ColorField/ColorSelector.d.ts +0 -19
  77. package/dist/types/components/ColorField/index.d.ts +0 -16
  78. package/dist/types/components/FileManager/Tooltip.d.ts +0 -2
  79. package/dist/types/components/Tip.d.ts +0 -18
  80. package/styles/tip.css +0 -82
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.1",
4
+ "version": "1.7.2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -18,53 +18,39 @@
18
18
  "build": "npm-run-all --parallel 'build:* --project tsconfig.build.json'",
19
19
  "build:cjs": "tsc --outDir dist/cjs --module commonjs",
20
20
  "build:es": "tsc --outDir dist/es --declarationDir dist/types --declaration",
21
- "build-storybook": "build-storybook",
21
+ "build-storybook": "storybook build",
22
22
  "dev": "npm-run-all --parallel 'build:* --project tsconfig.build.json --watch'",
23
23
  "lint": "eslint src stories --ext .ts,.tsx --max-warnings=0",
24
24
  "lint:fix": "eslint src stories --fix --ext .ts,.tsx --max-warnings=0",
25
25
  "prebuild": "rimraf dist",
26
26
  "prettier": "prettier --write \"{src,stories}/**/*.{ts,tsx}\"",
27
27
  "preversion": "npm-run-all --parallel lint typecheck test",
28
- "storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
28
+ "storybook": "storybook dev -p 6006",
29
29
  "test": "jest",
30
30
  "typecheck": "tsc --noEmit",
31
31
  "version": "yarn build",
32
32
  "prepare": "husky install"
33
33
  },
34
34
  "dependencies": {
35
- "@apollo/client": "^3.7.3",
36
- "@formatjs/intl-relativetimeformat": "^4.5.9",
37
- "@formatjs/intl-utils": "^2.2.0",
38
- "@manuscripts/assets": "^0.6.2",
39
- "@manuscripts/transform": "2.0.4",
35
+ "@manuscripts/assets": "^0.6.4",
40
36
  "@manuscripts/json-schema": "^2.2.2",
41
- "@reach/tabs": "^0.11.2",
37
+ "@manuscripts/transform": "2.0.4",
38
+ "@reach/tabs": "^0.18.0",
39
+ "date-fns": "^2.29.3",
42
40
  "formik": "^2.2.9",
43
41
  "fuzzysort": "^2.0.4",
44
- "date-fns": "^2.29.3",
45
- "lodash-es": "^4.17.21",
46
- "tooltip.js": "^1.3.3",
47
- "typeface-lato": "^1.1.13",
48
- "prosemirror-commands": "^1.5.0",
49
- "prosemirror-history": "^1.3.0",
50
- "prosemirror-inputrules": "^1.2.0",
51
- "prosemirror-keymap": "^1.2.0",
52
- "prosemirror-model": "^1.18.3",
53
- "prosemirror-state": "^1.4.2",
54
- "prosemirror-transform": "^1.7.0",
42
+ "lodash": "^4.17.21",
55
43
  "react": "^17.0.2",
56
- "react-color": "^2.19.3",
57
44
  "react-dnd": "^11.1.3",
58
45
  "react-dnd-html5-backend": "^11.1.3",
59
46
  "react-dom": "^17.0.2",
60
- "react-intl": "^3.12.0",
61
- "react-modal": "^3.11.2",
62
- "react-modern-calendar-datepicker": "^3.1.3",
63
- "react-popper": "^1.3.11",
64
- "react-router-dom": "^5.2.0",
47
+ "react-is": "^17.0.2",
48
+ "react-modal": "^3.16.1",
49
+ "react-modern-calendar-datepicker": "^3.1.6",
50
+ "react-router-dom": "^5.3.4",
65
51
  "react-select": "^5.7.3",
66
- "react-sizeme": "^2.6.12",
67
- "react-tooltip": "^4.2.11",
52
+ "react-sizeme": "^3.0.2",
53
+ "react-tooltip": "^5.26.0",
68
54
  "styled-components": "^5.2.0"
69
55
  },
70
56
  "devDependencies": {
@@ -72,21 +58,20 @@
72
58
  "@babel/preset-env": "^7.20.2",
73
59
  "@babel/preset-react": "^7.18.6",
74
60
  "@babel/preset-typescript": "^7.18.6",
75
- "@inline-svg-unique-id/react": "^1.2.3",
76
61
  "@manuscripts/eslint-config": "^0.5.1",
77
- "@storybook/addon-actions": "^6.5.15",
78
- "@storybook/addons": "^6.5.15",
79
- "@storybook/core": "^6.5.15",
80
- "@storybook/react": "^6.5.15",
62
+ "@storybook/addon-essentials": "^7.6.10",
63
+ "@storybook/addon-interactions": "^7.6.10",
64
+ "@storybook/addon-links": "^7.6.10",
65
+ "@storybook/blocks": "^7.6.10",
66
+ "@storybook/react": "^7.6.10",
67
+ "@storybook/react-webpack5": "^7.6.10",
68
+ "@storybook/test": "^7.6.10",
81
69
  "@types/jest": "^29.2.4",
82
- "@types/lodash-es": "^4.17.6",
83
- "@types/react": "^16.9.52",
84
- "@types/react-color": "^3.0.6",
85
- "@types/react-dom": "^16.9.8",
86
- "@types/react-modal": "^3.10.6",
87
- "@types/react-router-dom": "^5.1.6",
70
+ "@types/lodash": "^4.14.202",
88
71
  "@types/styled-components": "^5.1.4",
89
- "@types/uuid": "^9.0.0",
72
+ "@types/react-dom": "^17.0.2",
73
+ "@types/react-modal": "^3.16.3",
74
+ "@types/react-router-dom": "^5.3.3",
90
75
  "@typescript-eslint/eslint-plugin": "^5.47.0",
91
76
  "@typescript-eslint/parser": "^5.47.0",
92
77
  "babel-jest": "^29.3.1",
@@ -103,15 +88,19 @@
103
88
  "eslint-plugin-react": "^7.31.11",
104
89
  "eslint-plugin-react-hooks": "^4.6.0",
105
90
  "eslint-plugin-simple-import-sort": "^8.0.0",
91
+ "eslint-plugin-storybook": "^0.6.15",
106
92
  "husky": "^8.0.2",
107
93
  "jest": "^29.3.1",
108
94
  "jest-environment-jsdom": "^29.3.1",
109
95
  "npm-run-all": "^4.1.5",
110
96
  "prettier": "^2.8.1",
111
97
  "rimraf": "^3.0.0",
98
+ "storybook": "^7.6.10",
99
+ "typeface-lato": "^1.1.13",
112
100
  "typescript": "^4.4.4"
113
101
  },
114
102
  "resolutions": {
115
- "@types/react": "^17.0.2"
103
+ "@types/react": "^17.0.2",
104
+ "jackspeak": "2.1.1"
116
105
  }
117
106
  }
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 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.ColorField = void 0;
22
- const react_1 = __importDefault(require("react"));
23
- const styled_components_1 = __importDefault(require("styled-components"));
24
- const ColorSelector_1 = require("./ColorSelector");
25
- const ColorField = ({ options, value, handleChange, }) => (react_1.default.createElement(Container, null,
26
- options.map((color) => (react_1.default.createElement(ItemButton, { key: color.value, type: "button", color: color.value, isActive: value === color.value, onClick: () => handleChange(color.value) }))),
27
- react_1.default.createElement(ColorSelector_1.ColorSelector, { handleChange: handleChange })));
28
- exports.ColorField = ColorField;
29
- const Container = styled_components_1.default.div `
30
- display: flex;
31
- flex-wrap: wrap;
32
- align-items: center;
33
- `;
34
- const ItemButton = styled_components_1.default.button `
35
- background: ${(props) => props.color};
36
- box-shadow: ${(props) => (props.isActive ? '0 0 1px 1px #000' : 'none')};
37
- height: ${(props) => props.theme.grid.unit * 3}px;
38
- width: ${(props) => props.theme.grid.unit * 3}px;
39
- border-radius: 50%;
40
- margin: 2px;
41
- padding: 0;
42
- border: 1px solid ${(props) => props.theme.colors.border.tertiary};
43
- cursor: pointer;
44
- flex-shrink: 0;
45
-
46
- /* &:focus {
47
- outline: none;
48
- }*/
49
- `;
@@ -1,115 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.ColorSelector = void 0;
45
- const react_1 = __importStar(require("react"));
46
- const react_color_1 = require("react-color");
47
- const react_popper_1 = require("react-popper");
48
- const styled_components_1 = __importDefault(require("styled-components"));
49
- const Button_1 = require("../Button");
50
- const ColorSelector = ({ handleChange }) => {
51
- const [open, setOpen] = (0, react_1.useState)(false);
52
- const [color, setColor] = (0, react_1.useState)('#ffffff');
53
- const toggleOpen = (0, react_1.useCallback)(() => {
54
- setOpen((open) => !open);
55
- }, [setOpen]);
56
- const handleSave = (0, react_1.useCallback)(() => {
57
- if (color) {
58
- handleChange(color);
59
- }
60
- setOpen(false);
61
- }, [color, handleChange, setOpen]);
62
- const handleColorChange = (0, react_1.useCallback)((color) => {
63
- setColor(color.hex);
64
- }, [setColor]);
65
- const handleCancel = (0, react_1.useCallback)(() => {
66
- setOpen(false);
67
- }, [setOpen]);
68
- return (react_1.default.createElement(react_popper_1.Manager, null,
69
- react_1.default.createElement(react_popper_1.Reference, null, ({ ref }) => (react_1.default.createElement(AddButton, { ref: ref, type: 'button', onClick: toggleOpen }, "+"))),
70
- open && (react_1.default.createElement(react_popper_1.Popper, { placement: 'left' }, ({ ref, style, placement }) => (react_1.default.createElement("div", { ref: ref, style: Object.assign(Object.assign({}, style), { zIndex: 10 }), "data-placement": placement },
71
- react_1.default.createElement(PopperContent, null,
72
- react_1.default.createElement(react_color_1.ChromePicker, { onChangeComplete: handleColorChange, color: color }),
73
- react_1.default.createElement(Actions, null,
74
- react_1.default.createElement(Button_1.PrimaryButton, { mini: true, onClick: handleSave }, "Add color"),
75
- react_1.default.createElement(Button_1.SecondaryButton, { mini: true, onClick: handleCancel }, "Cancel")))))))));
76
- };
77
- exports.ColorSelector = ColorSelector;
78
- const Actions = styled_components_1.default.div `
79
- display: flex;
80
- justify-content: center;
81
- align-items: center;
82
- `;
83
- const PopperContent = styled_components_1.default.div `
84
- border: 1px solid ${(props) => props.theme.colors.text.muted};
85
- border-radius: ${(props) => props.theme.grid.radius.small};
86
- box-shadow: ${(props) => props.theme.shadow.dropShadow};
87
- background: ${(props) => props.theme.colors.background.primary};
88
- padding: ${(props) => props.theme.grid.unit * 2}px;
89
-
90
- .chrome-picker {
91
- box-shadow: none !important;
92
- }
93
- `;
94
- const AddButton = styled_components_1.default.button `
95
- display: inline-flex;
96
- align-items: center;
97
- justify-content: center;
98
- background: transparent;
99
- border: 1px solid transparent;
100
- border-radius: 50%;
101
- width: ${(props) => props.theme.grid.unit * 4}px;
102
- height: ${(props) => props.theme.grid.unit * 4}px;
103
- margin: 2px;
104
- cursor: pointer;
105
- line-height: 0;
106
- font-size: ${(props) => props.theme.font.size.medium};
107
-
108
- :hover {
109
- border-color: ${(props) => props.theme.colors.border.secondary};
110
- }
111
-
112
- :focus {
113
- outline: none;
114
- }
115
- `;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- __exportStar(require("./ColorField"), exports);
@@ -1,83 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.Tip = void 0;
45
- const react_1 = __importStar(require("react"));
46
- const styled_components_1 = __importDefault(require("styled-components"));
47
- const tooltip_js_1 = __importDefault(require("tooltip.js"));
48
- const TipContainer = styled_components_1.default.div `
49
- align-items: center;
50
- display: flex;
51
- font-family: ${(props) => props.theme.font.family.sans};
52
- justify-content: center;
53
- `;
54
- const Tip = ({ children, placement, title, }) => {
55
- const [tooltip, setTooltip] = (0, react_1.useState)();
56
- (0, react_1.useEffect)(() => () => {
57
- if (tooltip) {
58
- tooltip.dispose();
59
- }
60
- }, [tooltip]);
61
- const createTooltip = (0, react_1.useCallback)((node) => {
62
- if (node) {
63
- setTooltip(new tooltip_js_1.default(node, {
64
- placement,
65
- title,
66
- container: document.body,
67
- boundariesElement: 'window',
68
- }));
69
- }
70
- }, [setTooltip, placement, title]);
71
- const show = (0, react_1.useCallback)(() => {
72
- if (tooltip) {
73
- tooltip.show();
74
- }
75
- }, [tooltip]);
76
- const hide = (0, react_1.useCallback)(() => {
77
- if (tooltip) {
78
- tooltip.hide();
79
- }
80
- }, [tooltip]);
81
- return (react_1.default.createElement(TipContainer, { ref: createTooltip, onMouseEnter: show, onMouseLeave: hide }, children));
82
- };
83
- exports.Tip = Tip;
@@ -1,42 +0,0 @@
1
- /*!
2
- * © 2019 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 { ColorSelector } from './ColorSelector';
19
- export const ColorField = ({ options, value, handleChange, }) => (React.createElement(Container, null,
20
- options.map((color) => (React.createElement(ItemButton, { key: color.value, type: "button", color: color.value, isActive: value === color.value, onClick: () => handleChange(color.value) }))),
21
- React.createElement(ColorSelector, { handleChange: handleChange })));
22
- const Container = styled.div `
23
- display: flex;
24
- flex-wrap: wrap;
25
- align-items: center;
26
- `;
27
- const ItemButton = styled.button `
28
- background: ${(props) => props.color};
29
- box-shadow: ${(props) => (props.isActive ? '0 0 1px 1px #000' : 'none')};
30
- height: ${(props) => props.theme.grid.unit * 3}px;
31
- width: ${(props) => props.theme.grid.unit * 3}px;
32
- border-radius: 50%;
33
- margin: 2px;
34
- padding: 0;
35
- border: 1px solid ${(props) => props.theme.colors.border.tertiary};
36
- cursor: pointer;
37
- flex-shrink: 0;
38
-
39
- /* &:focus {
40
- outline: none;
41
- }*/
42
- `;
@@ -1,85 +0,0 @@
1
- /*!
2
- * © 2019 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, { useCallback, useState } from 'react';
17
- import { ChromePicker } from 'react-color';
18
- import { Manager, Popper, Reference } from 'react-popper';
19
- import styled from 'styled-components';
20
- import { PrimaryButton, SecondaryButton } from '../Button';
21
- export const ColorSelector = ({ handleChange }) => {
22
- const [open, setOpen] = useState(false);
23
- const [color, setColor] = useState('#ffffff');
24
- const toggleOpen = useCallback(() => {
25
- setOpen((open) => !open);
26
- }, [setOpen]);
27
- const handleSave = useCallback(() => {
28
- if (color) {
29
- handleChange(color);
30
- }
31
- setOpen(false);
32
- }, [color, handleChange, setOpen]);
33
- const handleColorChange = useCallback((color) => {
34
- setColor(color.hex);
35
- }, [setColor]);
36
- const handleCancel = useCallback(() => {
37
- setOpen(false);
38
- }, [setOpen]);
39
- return (React.createElement(Manager, null,
40
- React.createElement(Reference, null, ({ ref }) => (React.createElement(AddButton, { ref: ref, type: 'button', onClick: toggleOpen }, "+"))),
41
- open && (React.createElement(Popper, { placement: 'left' }, ({ ref, style, placement }) => (React.createElement("div", { ref: ref, style: Object.assign(Object.assign({}, style), { zIndex: 10 }), "data-placement": placement },
42
- React.createElement(PopperContent, null,
43
- React.createElement(ChromePicker, { onChangeComplete: handleColorChange, color: color }),
44
- React.createElement(Actions, null,
45
- React.createElement(PrimaryButton, { mini: true, onClick: handleSave }, "Add color"),
46
- React.createElement(SecondaryButton, { mini: true, onClick: handleCancel }, "Cancel")))))))));
47
- };
48
- const Actions = styled.div `
49
- display: flex;
50
- justify-content: center;
51
- align-items: center;
52
- `;
53
- const PopperContent = styled.div `
54
- border: 1px solid ${(props) => props.theme.colors.text.muted};
55
- border-radius: ${(props) => props.theme.grid.radius.small};
56
- box-shadow: ${(props) => props.theme.shadow.dropShadow};
57
- background: ${(props) => props.theme.colors.background.primary};
58
- padding: ${(props) => props.theme.grid.unit * 2}px;
59
-
60
- .chrome-picker {
61
- box-shadow: none !important;
62
- }
63
- `;
64
- const AddButton = styled.button `
65
- display: inline-flex;
66
- align-items: center;
67
- justify-content: center;
68
- background: transparent;
69
- border: 1px solid transparent;
70
- border-radius: 50%;
71
- width: ${(props) => props.theme.grid.unit * 4}px;
72
- height: ${(props) => props.theme.grid.unit * 4}px;
73
- margin: 2px;
74
- cursor: pointer;
75
- line-height: 0;
76
- font-size: ${(props) => props.theme.font.size.medium};
77
-
78
- :hover {
79
- border-color: ${(props) => props.theme.colors.border.secondary};
80
- }
81
-
82
- :focus {
83
- outline: none;
84
- }
85
- `;
@@ -1,16 +0,0 @@
1
- /*!
2
- * © 2019 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
- export * from './ColorField';
@@ -1,20 +0,0 @@
1
- import ReactTooltip from 'react-tooltip';
2
- import styled from 'styled-components';
3
- export const Tooltip = styled(ReactTooltip) `
4
- &.tooltip {
5
- font-size: 12px;
6
- line-height: 16px;
7
- font-family: ${(props) => props.theme.font.family.Lato};
8
- padding: 8px;
9
- border-radius: 6px;
10
- background: #353535;
11
- color: ${(props) => props.theme.colors.text.onDark};
12
- text-align: center;
13
- white-space: nowrap;
14
- pointer-events: none;
15
-
16
- &.place-bottom::after {
17
- background: #353535;
18
- }
19
- }
20
- `;
@@ -1,53 +0,0 @@
1
- /*!
2
- * © 2019 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, { useCallback, useEffect, useState } from 'react';
17
- import styled from 'styled-components';
18
- import Tooltip from 'tooltip.js';
19
- const TipContainer = styled.div `
20
- align-items: center;
21
- display: flex;
22
- font-family: ${(props) => props.theme.font.family.sans};
23
- justify-content: center;
24
- `;
25
- export const Tip = ({ children, placement, title, }) => {
26
- const [tooltip, setTooltip] = useState();
27
- useEffect(() => () => {
28
- if (tooltip) {
29
- tooltip.dispose();
30
- }
31
- }, [tooltip]);
32
- const createTooltip = useCallback((node) => {
33
- if (node) {
34
- setTooltip(new Tooltip(node, {
35
- placement,
36
- title,
37
- container: document.body,
38
- boundariesElement: 'window',
39
- }));
40
- }
41
- }, [setTooltip, placement, title]);
42
- const show = useCallback(() => {
43
- if (tooltip) {
44
- tooltip.show();
45
- }
46
- }, [tooltip]);
47
- const hide = useCallback(() => {
48
- if (tooltip) {
49
- tooltip.hide();
50
- }
51
- }, [tooltip]);
52
- return (React.createElement(TipContainer, { ref: createTooltip, onMouseEnter: show, onMouseLeave: hide }, children));
53
- };
@@ -1,27 +0,0 @@
1
- /*!
2
- * © 2019 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 { Color } from '@manuscripts/json-schema';
17
- import React from 'react';
18
- type ColorReq = Partial<Color> & {
19
- value: string;
20
- };
21
- interface Props {
22
- options: ColorReq[];
23
- value: string;
24
- handleChange: (color?: string) => void;
25
- }
26
- export declare const ColorField: React.FC<Props>;
27
- export {};