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.
@@ -13,6 +13,7 @@ type Props = {
13
13
  */
14
14
  onToggle: (isOn: boolean) => void;
15
15
  id?: string;
16
+ className?: string;
16
17
  description: string;
17
18
  backgroundVariantWhenOn?: Variant;
18
19
  };
@@ -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
@@ -617,6 +617,7 @@ type Props$2 = {
617
617
  */
618
618
  onToggle: (isOn: boolean) => void;
619
619
  id?: string;
620
+ className?: string;
620
621
  description: string;
621
622
  backgroundVariantWhenOn?: Variant;
622
623
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.7.16",
3
+ "version": "3.7.18",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -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;