studiokit-scaffolding-js 7.0.16 → 7.0.17
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/lib/components/ActionList.js +4 -14
- package/lib/components/ConnectedModal.js +2 -2
- package/lib/components/HOC/FullscreenModalComponent.d.ts +7 -19
- package/lib/components/HOC/FullscreenModalComponent.js +6 -54
- package/lib/css/base/_print.css +13 -9
- package/lib/css/components/_buttons.css +15 -5
- package/lib/css/components/_modals.css +25 -4
- package/lib/utils/dom.js +0 -4
- package/package.json +1 -3
|
@@ -29,13 +29,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
__setModuleDefault(result, mod);
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
33
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
34
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
35
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
36
|
-
r[k] = a[j];
|
|
37
|
-
return r;
|
|
38
|
-
};
|
|
39
32
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
40
33
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
34
|
};
|
|
@@ -81,13 +74,10 @@ var ActionList = function (_a) {
|
|
|
81
74
|
return (react_1.default.createElement(core_1.Grow, __assign({}, TransitionProps, { style: { transformOrigin: placement === 'bottom-end' ? 'top right' : 'bottom right' } }),
|
|
82
75
|
react_1.default.createElement(core_1.Paper, null,
|
|
83
76
|
react_1.default.createElement(core_1.ClickAwayListener, { onClickAway: onActionItemClick() },
|
|
84
|
-
react_1.default.createElement(core_1.MenuList, { id: "info-menu-" + model.id, autoFocusItem: !!infoMenuAnchorElement, onKeyDown: handleListKeyDown, className: "action-list shadow-large" }, allowedActions.map(function (a
|
|
85
|
-
return a.predicate
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
a.icon,
|
|
89
|
-
a.name)
|
|
90
|
-
]) : undefined;
|
|
77
|
+
react_1.default.createElement(core_1.MenuList, { id: "info-menu-" + model.id, autoFocusItem: !!infoMenuAnchorElement, onKeyDown: handleListKeyDown, className: "action-list shadow-large" }, allowedActions.map(function (a) {
|
|
78
|
+
return a.predicate ? (react_1.default.createElement(core_1.MenuItem, { key: a.id, className: "action-list-menu-item " + a.className, onClick: onActionItemClick(a.action), color: "primary", disabled: a.disabled },
|
|
79
|
+
a.icon,
|
|
80
|
+
a.name)) : undefined;
|
|
91
81
|
}))))));
|
|
92
82
|
})))));
|
|
93
83
|
};
|
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
var react_1 = __importDefault(require("react"));
|
|
29
29
|
var react_bootstrap_1 = require("react-bootstrap");
|
|
30
|
-
var ConnectedModalComponent_1 =
|
|
30
|
+
var ConnectedModalComponent_1 = require("./HOC/ConnectedModalComponent");
|
|
31
31
|
var ConnectedModal = function (_a) {
|
|
32
32
|
var
|
|
33
33
|
// exclude props that shouldn't be passed to the Modal
|
|
@@ -37,4 +37,4 @@ var ConnectedModal = function (_a) {
|
|
|
37
37
|
/**
|
|
38
38
|
* Wrapped version of "react-bootstrap"'s `Modal` component. Uses `ConnectedModalComponent` to coordinate modal state in redux.
|
|
39
39
|
*/
|
|
40
|
-
exports.default = ConnectedModalComponent_1.
|
|
40
|
+
exports.default = ConnectedModalComponent_1.connectedModalComponent(ConnectedModal);
|
|
@@ -3,7 +3,6 @@ import { ConnectedModalWrappedProps } from './ConnectedModalComponent';
|
|
|
3
3
|
import { GuidComponentWrappedProps } from './GuidComponent';
|
|
4
4
|
/**
|
|
5
5
|
* The props that are provided to the HOC component directly from the caller, not other wrapping HOCs
|
|
6
|
-
* NOTE: if more flexibility is needed, add more props from `ReactModal.Props`
|
|
7
6
|
*/
|
|
8
7
|
export interface FullscreenModalOwnProps {
|
|
9
8
|
isOpen?: boolean;
|
|
@@ -12,12 +11,10 @@ export interface FullscreenModalOwnProps {
|
|
|
12
11
|
* If not provided, the modal manages itself.
|
|
13
12
|
*/
|
|
14
13
|
closeModal?: () => void;
|
|
15
|
-
contentLabel?: string;
|
|
16
|
-
zIndex?: number;
|
|
17
14
|
}
|
|
18
15
|
/** The props that are provided to the HOC component, either directly or from other wrapping HOCs */
|
|
19
16
|
export declare type FullscreenModalComponentProps = FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps;
|
|
20
|
-
/** The props that are
|
|
17
|
+
/** The props that are provided to the wrapped component. */
|
|
21
18
|
export interface FullscreenModalWrappedProps {
|
|
22
19
|
/** GUID of the fullscreen modal, used in state.modals. */
|
|
23
20
|
guid: string;
|
|
@@ -28,19 +25,16 @@ interface FullscreenModalState {
|
|
|
28
25
|
isOpen: boolean;
|
|
29
26
|
}
|
|
30
27
|
/**
|
|
31
|
-
* HOC that manages a `
|
|
32
|
-
* coordinates modal state in redux using.
|
|
28
|
+
* HOC that manages a "react-boostrap" `Modal` and adds fullscreen styles.
|
|
33
29
|
*
|
|
34
30
|
* NOTE: Meant for testing. Should be wrapped in `connectedModalComponent` normally.
|
|
35
31
|
*
|
|
36
32
|
* @param WrappedComponent The component to wrap.
|
|
37
33
|
*/
|
|
38
|
-
export declare function configureFullscreenModalComponent<TOwnProps extends
|
|
34
|
+
export declare function configureFullscreenModalComponent<TOwnProps extends object>(WrappedComponent: ComponentType<TOwnProps & FullscreenModalWrappedProps>): {
|
|
39
35
|
new (props: TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps): {
|
|
40
36
|
componentDidMount(): void;
|
|
41
|
-
componentWillUnmount(): void;
|
|
42
37
|
componentDidUpdate(prevProps: TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps, prevState: FullscreenModalState): void;
|
|
43
|
-
disableScroll: (e: Event) => boolean;
|
|
44
38
|
onOpen: () => void;
|
|
45
39
|
onClose: () => void;
|
|
46
40
|
closeModal: () => void;
|
|
@@ -56,6 +50,7 @@ export declare function configureFullscreenModalComponent<TOwnProps extends {}>(
|
|
|
56
50
|
[key: string]: React.ReactInstance;
|
|
57
51
|
};
|
|
58
52
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextState: Readonly<FullscreenModalState>, nextContext: any): boolean;
|
|
53
|
+
componentWillUnmount?(): void;
|
|
59
54
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
60
55
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, prevState: Readonly<FullscreenModalState>): any;
|
|
61
56
|
componentWillMount?(): void;
|
|
@@ -68,18 +63,11 @@ export declare function configureFullscreenModalComponent<TOwnProps extends {}>(
|
|
|
68
63
|
contextType?: React.Context<any> | undefined;
|
|
69
64
|
};
|
|
70
65
|
/**
|
|
71
|
-
* HOC that
|
|
72
|
-
* adds fullscreen styles, and coordinates modal state in redux.
|
|
66
|
+
* HOC that manages a "react-bootstrap" `Modal` and adds fullscreen styles.
|
|
73
67
|
*
|
|
74
|
-
* Uses `connectedModalComponent
|
|
75
|
-
*
|
|
76
|
-
* NOTE: Please add the following css
|
|
77
|
-
*
|
|
78
|
-
* .ReactModal__Body--open {
|
|
79
|
-
* overflow: hidden;
|
|
80
|
-
* }
|
|
68
|
+
* Uses `connectedModalComponent` to coordinate modal state in redux.
|
|
81
69
|
*
|
|
82
70
|
* @param WrappedComponent The component to wrap.
|
|
83
71
|
*/
|
|
84
|
-
export declare function fullscreenModalComponent<TOwnProps extends
|
|
72
|
+
export declare function fullscreenModalComponent<TOwnProps extends object>(WrappedComponent: ComponentType<TOwnProps & FullscreenModalWrappedProps>): ComponentClass<TOwnProps & FullscreenModalOwnProps>;
|
|
85
73
|
export default fullscreenModalComponent;
|
|
@@ -53,17 +53,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
53
53
|
}
|
|
54
54
|
return t;
|
|
55
55
|
};
|
|
56
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
57
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
58
|
-
};
|
|
59
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
57
|
exports.fullscreenModalComponent = exports.configureFullscreenModalComponent = void 0;
|
|
61
58
|
var react_1 = __importStar(require("react"));
|
|
62
|
-
var
|
|
59
|
+
var react_bootstrap_1 = require("react-bootstrap");
|
|
63
60
|
var ConnectedModalComponent_1 = require("./ConnectedModalComponent");
|
|
64
61
|
/**
|
|
65
|
-
* HOC that manages a `
|
|
66
|
-
* coordinates modal state in redux using.
|
|
62
|
+
* HOC that manages a "react-boostrap" `Modal` and adds fullscreen styles.
|
|
67
63
|
*
|
|
68
64
|
* NOTE: Meant for testing. Should be wrapped in `connectedModalComponent` normally.
|
|
69
65
|
*
|
|
@@ -74,17 +70,10 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
74
70
|
__extends(FullscreenModalComponent, _super);
|
|
75
71
|
function FullscreenModalComponent(props) {
|
|
76
72
|
var _this = _super.call(this, props) || this;
|
|
77
|
-
_this.disableScroll = function (e) {
|
|
78
|
-
document.documentElement.scrollTop = 0;
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
return false;
|
|
81
|
-
};
|
|
82
73
|
_this.onOpen = function () {
|
|
83
|
-
document.documentElement.addEventListener('touchmove', _this.disableScroll);
|
|
84
74
|
_this.props.onEntering();
|
|
85
75
|
};
|
|
86
76
|
_this.onClose = function () {
|
|
87
|
-
document.documentElement.removeEventListener('touchmove', _this.disableScroll);
|
|
88
77
|
_this.props.onExited();
|
|
89
78
|
};
|
|
90
79
|
_this.closeModal = function () {
|
|
@@ -99,11 +88,6 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
99
88
|
_this.state = {
|
|
100
89
|
isOpen: props.isOpen === undefined ? true : props.isOpen
|
|
101
90
|
};
|
|
102
|
-
// https://github.com/reactjs/react-modal#app-element
|
|
103
|
-
// Accessibility fixed when reading the content in the modal
|
|
104
|
-
if (document.getElementById('root')) {
|
|
105
|
-
react_modal_1.default.setAppElement('#root');
|
|
106
|
-
}
|
|
107
91
|
return _this;
|
|
108
92
|
}
|
|
109
93
|
FullscreenModalComponent.prototype.componentDidMount = function () {
|
|
@@ -112,9 +96,6 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
112
96
|
this.onOpen();
|
|
113
97
|
}
|
|
114
98
|
};
|
|
115
|
-
FullscreenModalComponent.prototype.componentWillUnmount = function () {
|
|
116
|
-
document.documentElement.removeEventListener('touchmove', this.disableScroll);
|
|
117
|
-
};
|
|
118
99
|
FullscreenModalComponent.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
119
100
|
var isOpen;
|
|
120
101
|
if (this.props.isOpen !== undefined && this.props.isOpen !== this.state.isOpen) {
|
|
@@ -139,33 +120,11 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
139
120
|
});
|
|
140
121
|
};
|
|
141
122
|
FullscreenModalComponent.prototype.render = function () {
|
|
142
|
-
var _a = this.props,
|
|
123
|
+
var _a = this.props, isTopOpenFullscreenModal = _a.isTopOpenFullscreenModal, onEntering = _a.onEntering, onExited = _a.onExited, _ = _a.isOpen, closeModal = _a.closeModal, remainingProps = __rest(_a, ["isTopOpenFullscreenModal", "onEntering", "onExited", "isOpen", "closeModal"]);
|
|
143
124
|
// do not pass ConnectedModalWrappedProps to wrapped component
|
|
144
125
|
var wrappedProps = __assign(__assign({}, remainingProps), { closeModal: this.closeModal });
|
|
145
126
|
var isOpen = this.state.isOpen;
|
|
146
|
-
return (react_1.default.createElement(
|
|
147
|
-
content: {
|
|
148
|
-
position: 'absolute',
|
|
149
|
-
top: 0,
|
|
150
|
-
left: 0,
|
|
151
|
-
right: 0,
|
|
152
|
-
bottom: 0,
|
|
153
|
-
overflow: 'hidden',
|
|
154
|
-
padding: 0,
|
|
155
|
-
border: 'none',
|
|
156
|
-
backgroundColor: 'white'
|
|
157
|
-
},
|
|
158
|
-
overlay: {
|
|
159
|
-
position: 'absolute',
|
|
160
|
-
top: 0,
|
|
161
|
-
left: 0,
|
|
162
|
-
right: 0,
|
|
163
|
-
bottom: 0,
|
|
164
|
-
zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : 2000
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
// apply custom class, if this is not the top open fullscreen modal, to allow targeted styling (e.g. hide when printing in Safari)
|
|
168
|
-
portalClassName: "ReactModalPortal" + (!isTopOpenFullscreenModal ? ' HiddenFullscreenModal' : ''), shouldCloseOnOverlayClick: false },
|
|
127
|
+
return (react_1.default.createElement(react_bootstrap_1.Modal, { show: isOpen, backdrop: false, animation: false, className: "fullscreen-modal" },
|
|
169
128
|
react_1.default.createElement(WrappedComponent, __assign({}, wrappedProps))));
|
|
170
129
|
};
|
|
171
130
|
return FullscreenModalComponent;
|
|
@@ -173,16 +132,9 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
173
132
|
}
|
|
174
133
|
exports.configureFullscreenModalComponent = configureFullscreenModalComponent;
|
|
175
134
|
/**
|
|
176
|
-
* HOC that
|
|
177
|
-
* adds fullscreen styles, and coordinates modal state in redux.
|
|
178
|
-
*
|
|
179
|
-
* Uses `connectedModalComponent`.
|
|
180
|
-
*
|
|
181
|
-
* NOTE: Please add the following css
|
|
135
|
+
* HOC that manages a "react-bootstrap" `Modal` and adds fullscreen styles.
|
|
182
136
|
*
|
|
183
|
-
* .
|
|
184
|
-
* overflow: hidden;
|
|
185
|
-
* }
|
|
137
|
+
* Uses `connectedModalComponent` to coordinate modal state in redux.
|
|
186
138
|
*
|
|
187
139
|
* @param WrappedComponent The component to wrap.
|
|
188
140
|
*/
|
package/lib/css/base/_print.css
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
@media print {
|
|
15
15
|
/* override global react fullscreen modal styles */
|
|
16
|
-
.
|
|
16
|
+
.modal-open {
|
|
17
17
|
overflow: visible !important;
|
|
18
18
|
|
|
19
19
|
/* always hide content underneath the fullscreen modal */
|
|
@@ -22,25 +22,29 @@
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
.fullscreen-modal {
|
|
26
|
+
position: static;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
/* hide hidden fullscreen modal content when printing */
|
|
26
|
-
.
|
|
27
|
-
display: none;
|
|
30
|
+
.fullscreen-modal[aria-hidden="true"] {
|
|
31
|
+
display: none !important;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
.
|
|
34
|
+
.fullscreen-modal .modal-dialog {
|
|
35
|
+
overflow: visible !important;
|
|
36
|
+
|
|
31
37
|
/* safari-only */
|
|
32
38
|
@supports (-webkit-hyphens:none) {
|
|
33
|
-
|
|
39
|
+
border: none !important;
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
.fullscreen-modal .modal-dialog,
|
|
44
|
+
.fullscreen-modal .modal-dialog .modal-content {
|
|
40
45
|
/* safari-only */
|
|
41
46
|
@supports (-webkit-hyphens:none) {
|
|
42
47
|
position: static !important;
|
|
43
|
-
border: none !important;
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
}
|
|
@@ -281,6 +281,7 @@ button.close > span {
|
|
|
281
281
|
.action-list {
|
|
282
282
|
display: block;
|
|
283
283
|
min-width: 146px;
|
|
284
|
+
padding: 0;
|
|
284
285
|
|
|
285
286
|
& .btn-default {
|
|
286
287
|
padding: 0.5rem 1rem;
|
|
@@ -295,11 +296,20 @@ button.close > span {
|
|
|
295
296
|
align-self: stretch;
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
& .action-list-menu
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
& .action-list-menu-item {
|
|
300
|
+
padding-top: 0.75rem;
|
|
301
|
+
padding-bottom: 0.75rem;
|
|
302
|
+
|
|
303
|
+
& svg {
|
|
304
|
+
height: 2rem;
|
|
305
|
+
width: 2rem;
|
|
306
|
+
vertical-align: middle;
|
|
307
|
+
margin-right: 0.5rem;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&:not(:last-of-type) {
|
|
311
|
+
border-bottom: 1px solid var(--color-medium-grey);
|
|
312
|
+
}
|
|
303
313
|
}
|
|
304
314
|
}
|
|
305
315
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
.ReactModal__Body--open {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
1
|
.modal-dialog {
|
|
6
2
|
max-width: none;
|
|
7
3
|
width: auto;
|
|
@@ -40,6 +36,31 @@
|
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
|
|
39
|
+
.fullscreen-modal {
|
|
40
|
+
& .modal-dialog {
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 0;
|
|
43
|
+
left: 0;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
padding: 0;
|
|
46
|
+
margin: 0;
|
|
47
|
+
border: none;
|
|
48
|
+
background-color: white;
|
|
49
|
+
width: 100%;
|
|
50
|
+
transition: none !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
& .modal-content {
|
|
54
|
+
box-shadow: none;
|
|
55
|
+
border-radius: 0;
|
|
56
|
+
border: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.modal-open .fullscreen-modal {
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
}
|
|
63
|
+
|
|
43
64
|
/* Always display sentry feedback dialog on top of everything else. */
|
|
44
65
|
.sentry-error-embed-wrapper {
|
|
45
66
|
z-index: 9999 !important;
|
package/lib/utils/dom.js
CHANGED
|
@@ -188,10 +188,6 @@ var setupMobileEventListeners = function () {
|
|
|
188
188
|
// add event listeners
|
|
189
189
|
visualViewport.addEventListener('resize', function () {
|
|
190
190
|
setVisualViewportHeightVar();
|
|
191
|
-
// keep the document element scrolled to the top if a ReactModal is open
|
|
192
|
-
if (document.body.classList.contains('ReactModal__Body--open')) {
|
|
193
|
-
document.documentElement.scrollTop = 0;
|
|
194
|
-
}
|
|
195
191
|
});
|
|
196
192
|
window.addEventListener('focusin', onFocusIn);
|
|
197
193
|
window.addEventListener('focusout', onFocusOut);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "studiokit-scaffolding-js",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.17",
|
|
4
4
|
"description": "Common scaffolding for Studio apps at Purdue",
|
|
5
5
|
"repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
"@types/react": "^17.0.0",
|
|
102
102
|
"@types/react-dom": "^17.0.0",
|
|
103
103
|
"@types/react-helmet": "^6.1.0",
|
|
104
|
-
"@types/react-modal": "^3.16.3",
|
|
105
104
|
"@types/react-redux": "^7.1.16",
|
|
106
105
|
"@types/react-router": "^5.1.11",
|
|
107
106
|
"@types/react-router-bootstrap": "^0.24.5",
|
|
@@ -128,7 +127,6 @@
|
|
|
128
127
|
"react-bootstrap": "^1.4.3",
|
|
129
128
|
"react-ga4": "^2.1.0",
|
|
130
129
|
"react-helmet": "^6.1.0",
|
|
131
|
-
"react-modal": "^3.12.1",
|
|
132
130
|
"react-quill": "purdue-tlt/react-quill#fix/auto-focus",
|
|
133
131
|
"react-redux": "^7.2.2",
|
|
134
132
|
"react-router": "^5.2.0",
|