@manuscripts/style-guide 3.3.2 → 3.3.4
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/DraggableModal.js +10 -5
- package/dist/cjs/components/StyledModal.js +5 -3
- package/dist/cjs/components/ToggleHeader.js +1 -2
- package/dist/es/components/DraggableModal.js +10 -5
- package/dist/es/components/StyledModal.js +5 -3
- package/dist/es/components/ToggleHeader.js +1 -2
- package/dist/types/components/DraggableModal.d.ts +1 -0
- package/dist/types/components/StyledModal.d.ts +1 -0
- package/package.json +1 -1
|
@@ -55,7 +55,7 @@ exports.DraggableModal = void 0;
|
|
|
55
55
|
const react_1 = __importStar(require("react"));
|
|
56
56
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
57
57
|
const StyledModal_1 = require("./StyledModal");
|
|
58
|
-
const DraggableModal = ({ children, isOpen, onRequestClose }) => {
|
|
58
|
+
const DraggableModal = ({ children, isOpen, onRequestClose, hideOverlay }) => {
|
|
59
59
|
const [pos, setPos] = (0, react_1.useState)({ left: 0, top: 0, prevX: 0, prevY: 0 });
|
|
60
60
|
const [drag, setDrag] = (0, react_1.useState)(false);
|
|
61
61
|
const mouseDown = (event) => {
|
|
@@ -95,16 +95,21 @@ const DraggableModal = ({ children, isOpen, onRequestClose }) => {
|
|
|
95
95
|
document.removeEventListener('mouseup', mouseup);
|
|
96
96
|
};
|
|
97
97
|
}, []);
|
|
98
|
-
return (react_1.default.createElement(StyledModal_1.StyledModal, { isOpen: isOpen, onRequestClose: onRequestClose, shouldCloseOnOverlayClick: false, pointerEventsOnBackdrop: "none", style: {
|
|
98
|
+
return (react_1.default.createElement(StyledModal_1.StyledModal, { isOpen: isOpen, onRequestClose: onRequestClose, shouldCloseOnOverlayClick: false, pointerEventsOnBackdrop: "none", hideOverlay: hideOverlay, style: {
|
|
99
99
|
content: {
|
|
100
|
-
left:
|
|
101
|
-
|
|
100
|
+
left: '0',
|
|
101
|
+
bottom: '0',
|
|
102
102
|
transition: 'none',
|
|
103
|
+
position: 'fixed',
|
|
104
|
+
width: '100%',
|
|
103
105
|
},
|
|
104
106
|
} },
|
|
105
107
|
react_1.default.createElement(DraggableModalContainer, { onMouseDown: mouseDown, onMouseMove: mouseMove, "data-cy": "find-replace-modal" }, children)));
|
|
106
108
|
};
|
|
107
109
|
exports.DraggableModal = DraggableModal;
|
|
108
110
|
const DraggableModalContainer = (0, styled_components_1.default)(StyledModal_1.ModalContainer) `
|
|
109
|
-
padding:
|
|
111
|
+
padding: 1rem 1.5rem;
|
|
112
|
+
margin: 0;
|
|
113
|
+
height: 72px;
|
|
114
|
+
border-radius: 0;
|
|
110
115
|
`;
|
|
@@ -134,9 +134,11 @@ exports.StyledModal = (0, styled_components_1.default)(ReactModalAdapter).attrs(
|
|
|
134
134
|
left: 0;
|
|
135
135
|
right: 0;
|
|
136
136
|
bottom: 0;
|
|
137
|
-
background-color: ${(props) => props.
|
|
138
|
-
? '
|
|
139
|
-
: props.
|
|
137
|
+
background-color: ${(props) => props.hideOverlay
|
|
138
|
+
? 'transparent'
|
|
139
|
+
: props.pointerEventsOnBackdrop === 'none'
|
|
140
|
+
? 'rgba(0,0,0,0.1)'
|
|
141
|
+
: props.theme.colors.background.dark};
|
|
140
142
|
z-index: 1000;
|
|
141
143
|
display: flex;
|
|
142
144
|
justify-content: center;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
17
17
|
import styled from 'styled-components';
|
|
18
18
|
import { ModalContainer, StyledModal } from './StyledModal';
|
|
19
|
-
export const DraggableModal = ({ children, isOpen, onRequestClose }) => {
|
|
19
|
+
export const DraggableModal = ({ children, isOpen, onRequestClose, hideOverlay }) => {
|
|
20
20
|
const [pos, setPos] = useState({ left: 0, top: 0, prevX: 0, prevY: 0 });
|
|
21
21
|
const [drag, setDrag] = useState(false);
|
|
22
22
|
const mouseDown = (event) => {
|
|
@@ -56,15 +56,20 @@ export const DraggableModal = ({ children, isOpen, onRequestClose }) => {
|
|
|
56
56
|
document.removeEventListener('mouseup', mouseup);
|
|
57
57
|
};
|
|
58
58
|
}, []);
|
|
59
|
-
return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: onRequestClose, shouldCloseOnOverlayClick: false, pointerEventsOnBackdrop: "none", style: {
|
|
59
|
+
return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: onRequestClose, shouldCloseOnOverlayClick: false, pointerEventsOnBackdrop: "none", hideOverlay: hideOverlay, style: {
|
|
60
60
|
content: {
|
|
61
|
-
left:
|
|
62
|
-
|
|
61
|
+
left: '0',
|
|
62
|
+
bottom: '0',
|
|
63
63
|
transition: 'none',
|
|
64
|
+
position: 'fixed',
|
|
65
|
+
width: '100%',
|
|
64
66
|
},
|
|
65
67
|
} },
|
|
66
68
|
React.createElement(DraggableModalContainer, { onMouseDown: mouseDown, onMouseMove: mouseMove, "data-cy": "find-replace-modal" }, children)));
|
|
67
69
|
};
|
|
68
70
|
const DraggableModalContainer = styled(ModalContainer) `
|
|
69
|
-
padding:
|
|
71
|
+
padding: 1rem 1.5rem;
|
|
72
|
+
margin: 0;
|
|
73
|
+
height: 72px;
|
|
74
|
+
border-radius: 0;
|
|
70
75
|
`;
|
|
@@ -128,9 +128,11 @@ export const StyledModal = styled(ReactModalAdapter).attrs({
|
|
|
128
128
|
left: 0;
|
|
129
129
|
right: 0;
|
|
130
130
|
bottom: 0;
|
|
131
|
-
background-color: ${(props) => props.
|
|
132
|
-
? '
|
|
133
|
-
: props.
|
|
131
|
+
background-color: ${(props) => props.hideOverlay
|
|
132
|
+
? 'transparent'
|
|
133
|
+
: props.pointerEventsOnBackdrop === 'none'
|
|
134
|
+
? 'rgba(0,0,0,0.1)'
|
|
135
|
+
: props.theme.colors.background.dark};
|
|
134
136
|
z-index: 1000;
|
|
135
137
|
display: flex;
|
|
136
138
|
justify-content: center;
|
|
@@ -19,6 +19,7 @@ import { ThemeProps } from 'styled-components';
|
|
|
19
19
|
interface Props {
|
|
20
20
|
modalClassName?: ReactModal.Classes;
|
|
21
21
|
pointerEventsOnBackdrop?: 'all' | 'none' | 'auto';
|
|
22
|
+
hideOverlay?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export declare const ModalContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
24
25
|
export declare const ModalHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
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": "3.3.
|
|
4
|
+
"version": "3.3.4",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|