dce-reactkit 3.7.1 → 3.7.2-beta.1

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.1",
3
+ "version": "3.7.2-beta.1",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -6,9 +6,6 @@
6
6
  // Import React
7
7
  import React, { useEffect, useRef } from 'react';
8
8
 
9
- // Import Bootstrap
10
- import { Tooltip as BSTooltip } from 'bootstrap';
11
-
12
9
  /*------------------------------------------------------------------------*/
13
10
  /* -------------------------------- Types ------------------------------- */
14
11
  /*------------------------------------------------------------------------*/
@@ -58,19 +55,30 @@ const Tooltip: React.FC<Props> = (props) => {
58
55
  return;
59
56
  }
60
57
 
58
+ // Store copy of tooltip
59
+ let t: any;
60
+
61
61
  // Initialize tooltip
62
- const t = new BSTooltip(
63
- childRef.current,
64
- {
65
- title: text,
66
- placement: 'top',
67
- trigger: 'hover',
68
- },
69
- );
62
+ (async () => {
63
+ // Import bootstrap tooltip
64
+ const BSTooltip = (await import('bootstrap')).Tooltip;
65
+
66
+ // Initialize
67
+ t = new BSTooltip(
68
+ childRef.current,
69
+ {
70
+ title: text,
71
+ placement: 'top',
72
+ trigger: 'hover',
73
+ },
74
+ );
75
+ })();
70
76
 
71
77
  // Clean up tooltip
72
78
  return () => {
73
- t.dispose();
79
+ if (t) {
80
+ t.dispose();
81
+ }
74
82
  };
75
83
  },
76
84
  [text],