dce-reactkit 3.7.16 → 3.7.18
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 +30 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ToggleSwitch.d.ts +1 -0
- package/dist/cjs/types/stylesheets/shared.css.d.ts +6 -0
- package/dist/esm/index.js +30 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ToggleSwitch.d.ts +1 -0
- package/dist/esm/types/stylesheets/shared.css.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +7 -0
- package/src/components/ToggleSwitch.tsx +4 -1
- package/src/helpers/genRouteHandler.ts +7 -1
- package/src/stylesheets/shared.css.ts +18 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal stylesheet
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
declare const shared = "\n/* Button with no style */\n.btn-nostyle {\n border: 0 !important;\n background: transparent !important;\n outline: 0 !important;\n font-size: inherit !important;\n color: inherit !important;\n padding: 0 !important;\n margin: 0 !important;\n}\n";
|
|
6
|
+
export default shared;
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -37,8 +37,13 @@ import {
|
|
|
37
37
|
isDarkModeOn,
|
|
38
38
|
} from '../client/initClient';
|
|
39
39
|
import waitMs from '../helpers/waitMs';
|
|
40
|
+
|
|
41
|
+
// Import constants
|
|
40
42
|
import NUM_MODAL_PORTALS from '../constants/NUM_MODAL_PORTALS';
|
|
41
43
|
|
|
44
|
+
// Import style
|
|
45
|
+
import sharedStyle from '../stylesheets/shared.css';
|
|
46
|
+
|
|
42
47
|
/*------------------------------------------------------------------------*/
|
|
43
48
|
/* -------------------------------- Props ------------------------------- */
|
|
44
49
|
/*------------------------------------------------------------------------*/
|
|
@@ -383,6 +388,8 @@ const style = `
|
|
|
383
388
|
opacity: 1;
|
|
384
389
|
}
|
|
385
390
|
}
|
|
391
|
+
|
|
392
|
+
${sharedStyle}
|
|
386
393
|
`;
|
|
387
394
|
|
|
388
395
|
/*------------------------------------------------------------------------*/
|
|
@@ -29,6 +29,8 @@ type Props = {
|
|
|
29
29
|
onToggle: (isOn: boolean) => void,
|
|
30
30
|
// Unique ID for the toggle switch
|
|
31
31
|
id?: string,
|
|
32
|
+
// Custom className for the toggle switch
|
|
33
|
+
className?: string,
|
|
32
34
|
// A description for what it means when the toggle switch is on
|
|
33
35
|
// E.g. "airplane mode is active"
|
|
34
36
|
// Description will be placed into a sentence with the structure:
|
|
@@ -54,6 +56,7 @@ const ToggleSwitch: React.FC<Props> = (props) => {
|
|
|
54
56
|
isOn,
|
|
55
57
|
onToggle,
|
|
56
58
|
id,
|
|
59
|
+
className,
|
|
57
60
|
description,
|
|
58
61
|
backgroundVariantWhenOn = Variant.Info,
|
|
59
62
|
} = props;
|
|
@@ -76,7 +79,7 @@ const ToggleSwitch: React.FC<Props> = (props) => {
|
|
|
76
79
|
<button
|
|
77
80
|
id={id}
|
|
78
81
|
aria-label={`If on, ${description}. Currently ${isOn ? 'on' : 'off'}. Click to turn ${isOn ? 'off' : 'on'}.`}
|
|
79
|
-
className={`alert alert-${backgroundVariant} bg-${backgroundVariant} mb-0 rounded-pill d-inline-block pt-0 pb-0 px-3`}
|
|
82
|
+
className={`alert alert-${backgroundVariant} bg-${backgroundVariant} mb-0 rounded-pill d-inline-block pt-0 pb-0 px-3 ${className ?? ''}`}
|
|
80
83
|
onClick={() => {
|
|
81
84
|
onToggle(!isOn);
|
|
82
85
|
}}
|
|
@@ -738,7 +738,13 @@ const genRouteHandler = (
|
|
|
738
738
|
const html = genErrorPage(renderOpts);
|
|
739
739
|
send(html, renderOpts.status ?? 500);
|
|
740
740
|
|
|
741
|
-
// Log
|
|
741
|
+
// Log server-side error if not a session expired error or 404
|
|
742
|
+
if (renderOpts.status && renderOpts.status === 404) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
if (renderOpts.title?.toLowerCase().includes('session expired')) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
742
748
|
logServerEvent({
|
|
743
749
|
context: LogBuiltInMetadata.Context.ServerRenderedErrorPage,
|
|
744
750
|
error: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal stylesheet
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
const shared = `
|
|
6
|
+
/* Button with no style */
|
|
7
|
+
.btn-nostyle {
|
|
8
|
+
border: 0 !important;
|
|
9
|
+
background: transparent !important;
|
|
10
|
+
outline: 0 !important;
|
|
11
|
+
font-size: inherit !important;
|
|
12
|
+
color: inherit !important;
|
|
13
|
+
padding: 0 !important;
|
|
14
|
+
margin: 0 !important;
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export default shared;
|