dce-reactkit 3.7.36 → 3.7.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.7.36",
3
+ "version": "3.7.38",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -255,6 +255,9 @@ const Modal: React.FC<ModalProps> = (props) => {
255
255
  onTopOfOtherModals,
256
256
  } = props;
257
257
 
258
+ // Determine if no header either
259
+ const noHeader = (!title && type === ModalType.NoButtons);
260
+
258
261
  /* -------------- State ------------- */
259
262
 
260
263
  // True if animation is in use
@@ -457,59 +460,61 @@ const Modal: React.FC<ModalProps> = (props) => {
457
460
  ),
458
461
  }}
459
462
  >
460
- <div
461
- className="modal-header"
462
- style={{
463
- color: (
464
- isDarkModeOn()
465
- ? 'white'
466
- : undefined
467
- ),
468
- backgroundColor: (
469
- isDarkModeOn()
470
- ? '#444'
471
- : undefined
472
- ),
473
- borderBottom: (
474
- isDarkModeOn()
475
- ? '0.1rem solid gray'
476
- : undefined
477
- ),
478
- }}
479
- >
480
- <h5
481
- className="modal-title"
463
+ {!noHeader && (
464
+ <div
465
+ className="modal-header"
482
466
  style={{
483
- fontWeight: 'bold',
484
- fontSize: (
485
- largeTitle
486
- ? '1.6rem'
467
+ color: (
468
+ isDarkModeOn()
469
+ ? 'white'
470
+ : undefined
471
+ ),
472
+ backgroundColor: (
473
+ isDarkModeOn()
474
+ ? '#444'
475
+ : undefined
476
+ ),
477
+ borderBottom: (
478
+ isDarkModeOn()
479
+ ? '0.1rem solid gray'
487
480
  : undefined
488
481
  ),
489
482
  }}
490
483
  >
491
- {title}
492
- </h5>
493
-
494
- {(onClose && !dontShowXButton) && (
495
- <button
496
- type="button"
497
- className="Modal-x-button btn-close"
498
- aria-label="Close"
484
+ <h5
485
+ className="modal-title"
499
486
  style={{
500
- backgroundColor: (
501
- isDarkModeOn()
502
- ? 'white'
487
+ fontWeight: 'bold',
488
+ fontSize: (
489
+ largeTitle
490
+ ? '1.6rem'
503
491
  : undefined
504
492
  ),
505
493
  }}
506
- onClick={() => {
507
- // Handle close
508
- handleClose(ModalButtonType.Cancel);
509
- }}
510
- />
511
- )}
512
- </div>
494
+ >
495
+ {title}
496
+ </h5>
497
+
498
+ {(onClose && !dontShowXButton) && (
499
+ <button
500
+ type="button"
501
+ className="Modal-x-button btn-close"
502
+ aria-label="Close"
503
+ style={{
504
+ backgroundColor: (
505
+ isDarkModeOn()
506
+ ? 'white'
507
+ : undefined
508
+ ),
509
+ }}
510
+ onClick={() => {
511
+ // Handle close
512
+ handleClose(ModalButtonType.Cancel);
513
+ }}
514
+ />
515
+ )}
516
+ </div>
517
+ )}
513
518
  {children && (
514
519
  <div
515
520
  className="modal-body"
@@ -123,12 +123,24 @@ const visitServerEndpoint = async (
123
123
  );
124
124
  }
125
125
 
126
+ // Remove properties with undefined values
127
+ let params: { [key in string]: any } | undefined;
128
+ if (opts.params) {
129
+ params = Object.fromEntries(
130
+ Object
131
+ .entries(opts.params)
132
+ .filter(([key, value]) => {
133
+ return value !== undefined;
134
+ }),
135
+ );
136
+ }
137
+
126
138
  // Send the request
127
139
  const sendRequest = await getSendRequest();
128
140
  const response = await sendRequest({
129
141
  path: opts.path,
130
142
  method: opts.method ?? 'GET',
131
- params: opts.params,
143
+ params,
132
144
  });
133
145
 
134
146
  // Check for failure