dce-reactkit 3.7.9 → 3.7.10-beta.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/index.js +27 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +21 -0
- package/dist/cjs/types/components/Modal/ModalForWrapper.d.ts +9 -0
- package/dist/cjs/types/components/{Modal.d.ts → Modal/ModalProps.d.ts} +9 -9
- package/dist/cjs/types/components/Modal/index.d.ts +8 -0
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/esm/index.js +27 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +21 -0
- package/dist/esm/types/components/Modal/ModalForWrapper.d.ts +9 -0
- package/dist/esm/types/components/{Modal.d.ts → Modal/ModalProps.d.ts} +9 -9
- package/dist/esm/types/components/Modal/index.d.ts +8 -0
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/index.d.ts +117 -110
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +125 -1
- package/src/components/IntelliTable.tsx +1 -1
- package/src/components/{Modal.tsx → Modal/ModalForWrapper.tsx} +22 -83
- package/src/components/Modal/ModalProps.ts +72 -0
- package/src/components/Modal/index.tsx +105 -0
- package/src/index.ts +1 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import Variant from '../types/Variant';
|
|
8
|
+
import ModalProps from './Modal/ModalProps';
|
|
8
9
|
type Props = {
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
};
|
|
@@ -61,5 +62,25 @@ export declare const addFatalErrorHandler: (handler: () => void) => void;
|
|
|
61
62
|
* @author Gabe Abrams
|
|
62
63
|
*/
|
|
63
64
|
export declare const showSessionExpiredMessage: () => Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Add a modal to the screen
|
|
67
|
+
* @author Gabe Abrams
|
|
68
|
+
* @param id the uniqueId of the modal
|
|
69
|
+
* @param props the props for the modal
|
|
70
|
+
*/
|
|
71
|
+
export declare const addModal: (id: number, props: ModalProps) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Update a modal on the screen by id (if it exists) with new props
|
|
74
|
+
* @author Gabe Abrams
|
|
75
|
+
* @param id the uniqueId of the modal
|
|
76
|
+
* @param props the new props for the modal
|
|
77
|
+
*/
|
|
78
|
+
export declare const updateModal: (id: number, props: ModalProps) => Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Remove a modal from the screen by id (if it exists)
|
|
81
|
+
* @author Gabe Abrams
|
|
82
|
+
* @param id the uniqueId of the modal
|
|
83
|
+
*/
|
|
84
|
+
export declare const removeModal: (id: number) => Promise<void>;
|
|
64
85
|
declare const AppWrapper: React.FC<Props>;
|
|
65
86
|
export default AppWrapper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The displayable modal component (this is the modal that's added to the
|
|
3
|
+
* wrapper, not the one that the programmer renders)
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import ModalProps from './ModalProps';
|
|
8
|
+
declare const Modal: React.FC<ModalProps>;
|
|
9
|
+
export default Modal;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Variant from '../../types/Variant';
|
|
3
|
+
import ModalButtonType from '../../types/ModalButtonType';
|
|
4
|
+
import ModalSize from '../../types/ModalSize';
|
|
5
|
+
import ModalType from '../../types/ModalType';
|
|
1
6
|
/**
|
|
2
|
-
*
|
|
7
|
+
* Props for the Modal component
|
|
3
8
|
* @author Gabe Abrams
|
|
4
9
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import ModalButtonType from '../types/ModalButtonType';
|
|
8
|
-
import ModalSize from '../types/ModalSize';
|
|
9
|
-
import ModalType from '../types/ModalType';
|
|
10
|
-
type Props = {
|
|
10
|
+
type ModalProps = {
|
|
11
|
+
key?: string;
|
|
11
12
|
type?: ModalType;
|
|
12
13
|
size?: ModalSize;
|
|
13
14
|
title?: React.ReactNode;
|
|
@@ -37,5 +38,4 @@ type Props = {
|
|
|
37
38
|
confirmVariant?: Variant;
|
|
38
39
|
onTopOfOtherModals?: boolean;
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
-
export default Modal;
|
|
41
|
+
export default ModalProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AppWrapper, { alert, confirm, showFatalError, addFatalErrorHandler, leaveToURL } from './components/AppWrapper';
|
|
2
2
|
import LoadingSpinner from './components/LoadingSpinner';
|
|
3
3
|
import ErrorBox from './components/ErrorBox';
|
|
4
|
-
import Modal from './components/Modal';
|
|
4
|
+
import Modal from './components/Modal/ModalForWrapper';
|
|
5
5
|
import TabBox from './components/TabBox';
|
|
6
6
|
import RadioButton from './components/RadioButton';
|
|
7
7
|
import CheckboxButton from './components/CheckboxButton';
|
package/dist/esm/index.js
CHANGED
|
@@ -387,7 +387,7 @@ const getModalButtonTypeToLabelAndVariant = () => {
|
|
|
387
387
|
/* -------------------------------- Style ------------------------------- */
|
|
388
388
|
/*------------------------------------------------------------------------*/
|
|
389
389
|
const style$a = `
|
|
390
|
-
.
|
|
390
|
+
.ModalForWrapper-backdrop {
|
|
391
391
|
position: fixed;
|
|
392
392
|
top: 0;
|
|
393
393
|
left: 0;
|
|
@@ -395,7 +395,7 @@ const style$a = `
|
|
|
395
395
|
height: 200vh;
|
|
396
396
|
background-color: rgba(0, 0, 0, 0.7);
|
|
397
397
|
}
|
|
398
|
-
.
|
|
398
|
+
.ModalForWrapper-fading-in {
|
|
399
399
|
animation-name: Modal-fading-in;
|
|
400
400
|
animation-duration: ${Math.floor(MS_TO_ANIMATE * 2)}ms;
|
|
401
401
|
animation-iteration-count: 1;
|
|
@@ -410,7 +410,7 @@ const style$a = `
|
|
|
410
410
|
opacity: 1;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
.
|
|
413
|
+
.ModalForWrapper-animating-in {
|
|
414
414
|
animation-name: Modal-animating-in;
|
|
415
415
|
animation-duration: ${MS_TO_ANIMATE}ms;
|
|
416
416
|
animation-iteration-count: 1;
|
|
@@ -427,14 +427,14 @@ const style$a = `
|
|
|
427
427
|
opacity: 1;
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
.
|
|
431
|
-
animation-name:
|
|
430
|
+
.ModalForWrapper-animating-pop {
|
|
431
|
+
animation-name: ModalForWrapper-animating-pop;
|
|
432
432
|
animation-duration: ${MS_TO_ANIMATE}ms;
|
|
433
433
|
animation-iteration-count: 1;
|
|
434
434
|
animation-fill-mode: both;
|
|
435
435
|
animation-timing-function: ease-in-out;
|
|
436
436
|
}
|
|
437
|
-
@keyframes
|
|
437
|
+
@keyframes ModalForWrapper-animating-pop {
|
|
438
438
|
0% {
|
|
439
439
|
transform: scale(1);
|
|
440
440
|
opacity: 1;
|
|
@@ -527,7 +527,7 @@ const Modal = (props) => {
|
|
|
527
527
|
// Check if this button is last
|
|
528
528
|
const last = (i === ModalButtonTypes.length - 1);
|
|
529
529
|
// Create the button
|
|
530
|
-
return (React__default.createElement("button", { key: modalButtonType, type: "button", className: `
|
|
530
|
+
return (React__default.createElement("button", { key: modalButtonType, type: "button", className: `ModalForWrapper-${modalButtonType}-button btn btn-${variant} ${last ? '' : 'me-1'}`, onClick: () => {
|
|
531
531
|
handleClose(modalButtonType);
|
|
532
532
|
} }, label));
|
|
533
533
|
});
|
|
@@ -539,11 +539,11 @@ const Modal = (props) => {
|
|
|
539
539
|
let animationClass = '';
|
|
540
540
|
let backdropAnimationClass = '';
|
|
541
541
|
if (animatingIn) {
|
|
542
|
-
animationClass = '
|
|
543
|
-
backdropAnimationClass = '
|
|
542
|
+
animationClass = 'ModalForWrapper-animating-in';
|
|
543
|
+
backdropAnimationClass = 'ModalForWrapper-fading-in';
|
|
544
544
|
}
|
|
545
545
|
else if (animatingPop) {
|
|
546
|
-
animationClass = '
|
|
546
|
+
animationClass = 'ModalForWrapper-animating-pop';
|
|
547
547
|
}
|
|
548
548
|
// Render the modal
|
|
549
549
|
return (React__default.createElement("div", { className: "modal show", tabIndex: -1, style: {
|
|
@@ -556,7 +556,7 @@ const Modal = (props) => {
|
|
|
556
556
|
right: 0,
|
|
557
557
|
} },
|
|
558
558
|
React__default.createElement("style", null, style$a),
|
|
559
|
-
React__default.createElement("div", { className: `
|
|
559
|
+
React__default.createElement("div", { className: `ModalForWrapper-backdrop ${backdropAnimationClass}`, style: {
|
|
560
560
|
zIndex: 5000000003,
|
|
561
561
|
}, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
562
562
|
// Skip if exit via backdrop not allowed
|
|
@@ -595,7 +595,7 @@ const Modal = (props) => {
|
|
|
595
595
|
React__default.createElement("h5", { className: "modal-title", style: {
|
|
596
596
|
fontWeight: 'bold',
|
|
597
597
|
} }, title),
|
|
598
|
-
(onClose && !dontShowXButton) && (React__default.createElement("button", { type: "button", className: "
|
|
598
|
+
(onClose && !dontShowXButton) && (React__default.createElement("button", { type: "button", className: "ModalForWrapper-x-button btn-close", "aria-label": "Close", style: {
|
|
599
599
|
backgroundColor: (isDarkModeOn()
|
|
600
600
|
? 'white'
|
|
601
601
|
: undefined),
|
|
@@ -1105,6 +1105,8 @@ const AppWrapper = (props) => {
|
|
|
1105
1105
|
// Session expired
|
|
1106
1106
|
const [sessionHasExpired, setSessionHasExpiredInner,] = useState(false);
|
|
1107
1107
|
setSessionHasExpired = setSessionHasExpiredInner;
|
|
1108
|
+
// Modals
|
|
1109
|
+
const [modalsFromState, setModalsInner,] = useState([]);
|
|
1108
1110
|
/*------------------------------------------------------------------------*/
|
|
1109
1111
|
/* ------------------------------- Render ------------------------------- */
|
|
1110
1112
|
/*------------------------------------------------------------------------*/
|
|
@@ -1132,6 +1134,14 @@ const AppWrapper = (props) => {
|
|
|
1132
1134
|
}
|
|
1133
1135
|
}, dontAllowBackdropExit: true }, confirmInfo.text));
|
|
1134
1136
|
}
|
|
1137
|
+
/* ---------- Custom Modals --------- */
|
|
1138
|
+
// List of modals added outside reactkit via the Modal component
|
|
1139
|
+
const customModals = [];
|
|
1140
|
+
// Add custom modals
|
|
1141
|
+
modalsFromState.forEach((modalTuple) => {
|
|
1142
|
+
var _a;
|
|
1143
|
+
customModals.push(React__default.createElement(Modal, Object.assign({ key: String((_a = modalTuple.props.key) !== null && _a !== void 0 ? _a : modalTuple.id) }, modalTuple.props)));
|
|
1144
|
+
});
|
|
1135
1145
|
/*----------------------------------------*/
|
|
1136
1146
|
/* ---------------- Views --------------- */
|
|
1137
1147
|
/*----------------------------------------*/
|
|
@@ -1196,10 +1206,12 @@ const AppWrapper = (props) => {
|
|
|
1196
1206
|
background-color: white;
|
|
1197
1207
|
color: black;
|
|
1198
1208
|
border: 0.1rem solid black;
|
|
1209
|
+
pointer-events: none;
|
|
1199
1210
|
}
|
|
1200
1211
|
div[data-popper-placement="top"] .tooltip-arrow::before {
|
|
1201
1212
|
border-top-color: white !important;
|
|
1202
1213
|
transform: translate(0, -0.05rem);
|
|
1214
|
+
pointer-events: none;
|
|
1203
1215
|
}
|
|
1204
1216
|
`
|
|
1205
1217
|
: `
|
|
@@ -1207,10 +1219,12 @@ const AppWrapper = (props) => {
|
|
|
1207
1219
|
background-color: black;
|
|
1208
1220
|
color: black;
|
|
1209
1221
|
border: 0.1rem solid white;
|
|
1222
|
+
pointer-events: none;
|
|
1210
1223
|
}
|
|
1211
1224
|
div[data-popper-placement="top"] .tooltip-arrow::before {
|
|
1212
1225
|
border-top-color: black !important;
|
|
1213
1226
|
transform: translate(0, -0.05rem);
|
|
1227
|
+
pointer-events: none;
|
|
1214
1228
|
}
|
|
1215
1229
|
`);
|
|
1216
1230
|
/*----------------------------------------*/
|
|
@@ -1220,6 +1234,7 @@ const AppWrapper = (props) => {
|
|
|
1220
1234
|
React__default.createElement("style", null, style$9),
|
|
1221
1235
|
React__default.createElement("style", null, tooltipStyle),
|
|
1222
1236
|
modal,
|
|
1237
|
+
customModals,
|
|
1223
1238
|
body));
|
|
1224
1239
|
};
|
|
1225
1240
|
|