@khanacademy/wonder-blocks-tooltip 1.4.5 → 1.4.7
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/CHANGELOG.md +43 -0
- package/dist/components/tooltip-anchor.d.ts +85 -0
- package/dist/components/tooltip-anchor.js.flow +98 -0
- package/dist/components/tooltip-bubble.d.ts +36 -0
- package/dist/components/tooltip-bubble.js.flow +72 -0
- package/dist/components/tooltip-content.d.ts +33 -0
- package/dist/components/tooltip-content.js.flow +44 -0
- package/dist/components/tooltip-popper.d.ts +32 -0
- package/dist/components/tooltip-popper.js.flow +39 -0
- package/dist/components/tooltip-tail.d.ts +57 -0
- package/dist/components/tooltip-tail.js.flow +77 -0
- package/dist/components/tooltip.d.ts +150 -0
- package/dist/components/tooltip.js.flow +159 -0
- package/dist/es/index.js +220 -273
- package/dist/index.d.ts +8 -0
- package/dist/index.js +234 -288
- package/dist/index.js.flow +20 -2
- package/dist/util/active-tracker.d.ts +61 -0
- package/dist/util/active-tracker.js.flow +71 -0
- package/dist/util/constants.d.ts +6 -0
- package/dist/util/constants.js.flow +13 -0
- package/dist/util/ref-tracker.d.ts +16 -0
- package/dist/util/ref-tracker.js.flow +16 -0
- package/dist/util/types.d.ts +11 -0
- package/dist/util/types.js.flow +36 -0
- package/package.json +9 -9
- package/src/components/__tests__/{tooltip-anchor.test.js → tooltip-anchor.test.tsx} +42 -52
- package/src/components/__tests__/{tooltip-bubble.test.js → tooltip-bubble.test.tsx} +5 -5
- package/src/components/__tests__/{tooltip-popper.test.js → tooltip-popper.test.tsx} +16 -13
- package/src/components/__tests__/{tooltip-tail.test.js → tooltip-tail.test.tsx} +7 -6
- package/src/components/__tests__/{tooltip.integration.test.js → tooltip.integration.test.tsx} +1 -2
- package/src/components/__tests__/{tooltip.test.js → tooltip.test.tsx} +11 -9
- package/src/components/{tooltip-anchor.js → tooltip-anchor.tsx} +29 -30
- package/src/components/{tooltip-bubble.js → tooltip-bubble.tsx} +20 -32
- package/src/components/{tooltip-content.js → tooltip-content.tsx} +8 -10
- package/src/components/{tooltip-popper.js → tooltip-popper.tsx} +17 -17
- package/src/components/{tooltip-tail.js → tooltip-tail.tsx} +29 -33
- package/src/components/{tooltip.js → tooltip.tsx} +40 -44
- package/src/index.ts +11 -0
- package/src/util/__tests__/{active-tracker.test.js → active-tracker.test.ts} +2 -3
- package/src/util/__tests__/{ref-tracker.test.js → ref-tracker.test.tsx} +14 -8
- package/src/util/{active-tracker.js → active-tracker.ts} +1 -2
- package/src/util/{constants.js → constants.ts} +0 -1
- package/src/util/{ref-tracker.js → ref-tracker.ts} +14 -7
- package/src/util/types.ts +32 -0
- package/tsconfig.json +16 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/src/components/__docs__/tooltip-content.stories.js +0 -89
- package/src/components/__docs__/tooltip.argtypes.js +0 -15
- package/src/components/__docs__/tooltip.stories.js +0 -335
- package/src/index.js +0 -12
- package/src/util/types.js +0 -29
- /package/src/util/__tests__/__snapshots__/{active-tracker.test.js.snap → active-tracker.test.ts.snap} +0 -0
- /package/src/util/__tests__/__snapshots__/{ref-tracker.test.js.snap → ref-tracker.test.tsx.snap} +0 -0
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ var wonderBlocksModal = require('@khanacademy/wonder-blocks-modal');
|
|
|
9
9
|
var aphrodite = require('aphrodite');
|
|
10
10
|
var Colors = require('@khanacademy/wonder-blocks-color');
|
|
11
11
|
var Spacing = require('@khanacademy/wonder-blocks-spacing');
|
|
12
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
13
12
|
var wonderBlocksLayout = require('@khanacademy/wonder-blocks-layout');
|
|
14
13
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
15
14
|
var reactPopper = require('react-popper');
|
|
@@ -17,134 +16,135 @@ var reactPopper = require('react-popper');
|
|
|
17
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
17
|
|
|
19
18
|
function _interopNamespace(e) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
}
|
|
19
|
+
if (e && e.__esModule) return e;
|
|
20
|
+
var n = Object.create(null);
|
|
21
|
+
if (e) {
|
|
22
|
+
Object.keys(e).forEach(function (k) {
|
|
23
|
+
if (k !== 'default') {
|
|
24
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return e[k]; }
|
|
31
28
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
n["default"] = e;
|
|
33
|
+
return Object.freeze(n);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
38
37
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
39
38
|
var Colors__default = /*#__PURE__*/_interopDefaultLegacy(Colors);
|
|
40
39
|
var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
|
|
41
|
-
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
function _setPrototypeOf(o, p) {
|
|
42
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
43
|
+
o.__proto__ = p;
|
|
44
|
+
return o;
|
|
45
|
+
};
|
|
46
|
+
return _setPrototypeOf(o, p);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _inheritsLoose(subClass, superClass) {
|
|
50
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
51
|
+
subClass.prototype.constructor = subClass;
|
|
52
|
+
_setPrototypeOf(subClass, superClass);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let ActiveTracker = function () {
|
|
56
|
+
function ActiveTracker() {
|
|
45
57
|
this._subscribers = [];
|
|
58
|
+
this._active = void 0;
|
|
46
59
|
}
|
|
47
|
-
|
|
48
|
-
_getIndex(who) {
|
|
60
|
+
var _proto = ActiveTracker.prototype;
|
|
61
|
+
_proto._getIndex = function _getIndex(who) {
|
|
49
62
|
return this._subscribers.findIndex(v => v === who);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
steal(who) {
|
|
63
|
+
};
|
|
64
|
+
_proto.steal = function steal(who) {
|
|
53
65
|
const wasActive = !!this._active;
|
|
54
66
|
this._active = true;
|
|
55
|
-
|
|
56
67
|
for (const anchor of this._subscribers) {
|
|
57
68
|
if (anchor === who) {
|
|
58
69
|
continue;
|
|
59
70
|
}
|
|
60
|
-
|
|
61
71
|
anchor.activeStateStolen();
|
|
62
72
|
}
|
|
63
|
-
|
|
64
73
|
return wasActive;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
giveup() {
|
|
74
|
+
};
|
|
75
|
+
_proto.giveup = function giveup() {
|
|
68
76
|
this._active = false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
subscribe(who) {
|
|
77
|
+
};
|
|
78
|
+
_proto.subscribe = function subscribe(who) {
|
|
72
79
|
if (this._getIndex(who) >= 0) {
|
|
73
80
|
throw new Error("Already subscribed.");
|
|
74
81
|
}
|
|
75
|
-
|
|
76
82
|
this._subscribers.push(who);
|
|
77
|
-
|
|
78
83
|
const unsubscribe = () => {
|
|
79
84
|
const index = this._getIndex(who);
|
|
80
|
-
|
|
81
85
|
this._subscribers.splice(index, 1);
|
|
82
86
|
};
|
|
83
|
-
|
|
84
87
|
return unsubscribe;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
+
};
|
|
89
|
+
return ActiveTracker;
|
|
90
|
+
}();
|
|
88
91
|
|
|
89
92
|
const TooltipAppearanceDelay = 100;
|
|
90
93
|
const TooltipDisappearanceDelay = 75;
|
|
91
94
|
|
|
92
95
|
const TRACKER = new ActiveTracker();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
let TooltipAnchor = function (_ref) {
|
|
97
|
+
_inheritsLoose(TooltipAnchor, _ref);
|
|
98
|
+
function TooltipAnchor(props) {
|
|
99
|
+
var _this;
|
|
100
|
+
_this = _ref.call(this, props) || this;
|
|
101
|
+
_this._weSetFocusivity = void 0;
|
|
102
|
+
_this._anchorNode = void 0;
|
|
103
|
+
_this._focused = void 0;
|
|
104
|
+
_this._hovered = void 0;
|
|
105
|
+
_this._stolenFromUs = void 0;
|
|
106
|
+
_this._unsubscribeFromTracker = void 0;
|
|
107
|
+
_this._timeoutID = void 0;
|
|
108
|
+
_this.activeStateStolen = () => {
|
|
109
|
+
_this._stolenFromUs = _this.state.active || !!_this._timeoutID;
|
|
110
|
+
_this._focused = false;
|
|
111
|
+
_this._setActiveState(false, true);
|
|
102
112
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this._updateActiveState(this._hovered, true);
|
|
113
|
+
_this._handleFocusIn = () => {
|
|
114
|
+
_this._updateActiveState(_this._hovered, true);
|
|
106
115
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this._updateActiveState(this._hovered, false);
|
|
116
|
+
_this._handleFocusOut = () => {
|
|
117
|
+
_this._updateActiveState(_this._hovered, false);
|
|
110
118
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
this._updateActiveState(true, this._focused);
|
|
119
|
+
_this._handleMouseEnter = () => {
|
|
120
|
+
_this._updateActiveState(true, _this._focused);
|
|
114
121
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this._updateActiveState(false, this._focused);
|
|
122
|
+
_this._handleMouseLeave = () => {
|
|
123
|
+
_this._updateActiveState(false, _this._focused);
|
|
118
124
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (e.key === "Escape" && this.state.active) {
|
|
125
|
+
_this._handleKeyUp = e => {
|
|
126
|
+
if (e.key === "Escape" && _this.state.active) {
|
|
122
127
|
e.preventDefault();
|
|
123
128
|
e.stopPropagation();
|
|
124
|
-
|
|
125
|
-
this._updateActiveState(false, false);
|
|
129
|
+
_this._updateActiveState(false, false);
|
|
126
130
|
}
|
|
127
131
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.state = {
|
|
132
|
+
_this._focused = false;
|
|
133
|
+
_this._hovered = false;
|
|
134
|
+
_this.state = {
|
|
132
135
|
active: false
|
|
133
136
|
};
|
|
137
|
+
return _this;
|
|
134
138
|
}
|
|
135
|
-
|
|
136
|
-
componentDidMount() {
|
|
139
|
+
var _proto = TooltipAnchor.prototype;
|
|
140
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
137
141
|
const anchorNode = ReactDOM__namespace.findDOMNode(this);
|
|
138
|
-
|
|
139
142
|
if (anchorNode instanceof Text) {
|
|
140
143
|
throw new Error("TooltipAnchor must be applied to an Element. Text content is not supported.");
|
|
141
144
|
}
|
|
142
|
-
|
|
143
145
|
this._unsubscribeFromTracker = TRACKER.subscribe(this);
|
|
144
146
|
this._anchorNode = anchorNode;
|
|
145
|
-
|
|
146
147
|
this._updateFocusivity();
|
|
147
|
-
|
|
148
148
|
if (anchorNode) {
|
|
149
149
|
anchorNode.addEventListener("focusin", this._handleFocusIn);
|
|
150
150
|
anchorNode.addEventListener("focusout", this._handleFocusOut);
|
|
@@ -152,47 +152,37 @@ class TooltipAnchor extends React__namespace.Component {
|
|
|
152
152
|
anchorNode.addEventListener("mouseleave", this._handleMouseLeave);
|
|
153
153
|
this.props.anchorRef(this._anchorNode);
|
|
154
154
|
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
componentDidUpdate(prevProps) {
|
|
155
|
+
};
|
|
156
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
158
157
|
if (prevProps.forceAnchorFocusivity !== this.props.forceAnchorFocusivity || prevProps.children !== this.props.children) {
|
|
159
158
|
this._updateFocusivity();
|
|
160
159
|
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
componentWillUnmount() {
|
|
160
|
+
};
|
|
161
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
164
162
|
if (this._unsubscribeFromTracker) {
|
|
165
163
|
this._unsubscribeFromTracker();
|
|
166
164
|
}
|
|
167
|
-
|
|
168
165
|
this._clearPendingAction();
|
|
169
|
-
|
|
170
166
|
const anchorNode = this._anchorNode;
|
|
171
|
-
|
|
172
167
|
if (anchorNode) {
|
|
173
168
|
anchorNode.removeEventListener("focusin", this._handleFocusIn);
|
|
174
169
|
anchorNode.removeEventListener("focusout", this._handleFocusOut);
|
|
175
170
|
anchorNode.removeEventListener("mouseenter", this._handleMouseEnter);
|
|
176
171
|
anchorNode.removeEventListener("mouseleave", this._handleMouseLeave);
|
|
177
172
|
}
|
|
178
|
-
|
|
179
173
|
if (this.state.active) {
|
|
180
174
|
document.removeEventListener("keyup", this._handleKeyUp);
|
|
181
175
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
_updateFocusivity() {
|
|
176
|
+
};
|
|
177
|
+
_proto._updateFocusivity = function _updateFocusivity() {
|
|
185
178
|
const anchorNode = this._anchorNode;
|
|
186
|
-
|
|
187
179
|
if (!anchorNode) {
|
|
188
180
|
return;
|
|
189
181
|
}
|
|
190
|
-
|
|
191
182
|
const {
|
|
192
183
|
forceAnchorFocusivity
|
|
193
184
|
} = this.props;
|
|
194
185
|
const currentTabIndex = anchorNode.getAttribute("tabindex");
|
|
195
|
-
|
|
196
186
|
if (forceAnchorFocusivity && !currentTabIndex) {
|
|
197
187
|
anchorNode.setAttribute("tabindex", "0");
|
|
198
188
|
this._weSetFocusivity = true;
|
|
@@ -202,95 +192,99 @@ class TooltipAnchor extends React__namespace.Component {
|
|
|
202
192
|
this._weSetFocusivity = false;
|
|
203
193
|
}
|
|
204
194
|
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
_updateActiveState(hovered, focused) {
|
|
195
|
+
};
|
|
196
|
+
_proto._updateActiveState = function _updateActiveState(hovered, focused) {
|
|
208
197
|
this._hovered = hovered;
|
|
209
198
|
this._focused = focused;
|
|
210
|
-
|
|
211
199
|
this._setActiveState(hovered || focused);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
_clearPendingAction() {
|
|
200
|
+
};
|
|
201
|
+
_proto._clearPendingAction = function _clearPendingAction() {
|
|
215
202
|
if (this._timeoutID) {
|
|
216
203
|
clearTimeout(this._timeoutID);
|
|
217
204
|
this._timeoutID = null;
|
|
218
205
|
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
_setActiveState(active, instant) {
|
|
206
|
+
};
|
|
207
|
+
_proto._setActiveState = function _setActiveState(active, instant) {
|
|
222
208
|
if (this._stolenFromUs || active !== this.state.active || !this.state.active && this._timeoutID) {
|
|
223
209
|
this._clearPendingAction();
|
|
224
210
|
} else if (active === this.state.active && !this._timeoutID) {
|
|
225
211
|
return;
|
|
226
212
|
}
|
|
227
|
-
|
|
228
213
|
instant = instant || active && TRACKER.steal(this);
|
|
229
|
-
|
|
230
214
|
if (instant) {
|
|
231
215
|
if (active) {
|
|
232
216
|
document.addEventListener("keyup", this._handleKeyUp);
|
|
233
217
|
} else {
|
|
234
218
|
document.removeEventListener("keyup", this._handleKeyUp);
|
|
235
219
|
}
|
|
236
|
-
|
|
237
220
|
this.setState({
|
|
238
221
|
active
|
|
239
222
|
});
|
|
240
223
|
this.props.onActiveChanged(active);
|
|
241
|
-
|
|
242
224
|
if (!this._stolenFromUs && !active) {
|
|
243
225
|
TRACKER.giveup();
|
|
244
226
|
}
|
|
245
|
-
|
|
246
227
|
this._stolenFromUs = false;
|
|
247
228
|
} else {
|
|
248
229
|
const delay = active ? TooltipAppearanceDelay : TooltipDisappearanceDelay;
|
|
249
230
|
this._timeoutID = setTimeout(() => {
|
|
250
231
|
this._timeoutID = null;
|
|
251
|
-
|
|
252
232
|
this._setActiveState(active, true);
|
|
253
233
|
}, delay);
|
|
254
234
|
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
_renderAnchorableChildren() {
|
|
235
|
+
};
|
|
236
|
+
_proto._renderAnchorableChildren = function _renderAnchorableChildren() {
|
|
258
237
|
const {
|
|
259
238
|
children
|
|
260
239
|
} = this.props;
|
|
261
240
|
return typeof children === "string" ? React__namespace.createElement(wonderBlocksCore.Text, null, children) : children;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
_renderAccessibleChildren(ids) {
|
|
241
|
+
};
|
|
242
|
+
_proto._renderAccessibleChildren = function _renderAccessibleChildren(ids) {
|
|
265
243
|
const anchorableChildren = this._renderAnchorableChildren();
|
|
266
|
-
|
|
267
244
|
return React__namespace.cloneElement(anchorableChildren, {
|
|
268
245
|
"aria-describedby": ids.get(TooltipAnchor.ariaContentId)
|
|
269
246
|
});
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
render() {
|
|
247
|
+
};
|
|
248
|
+
_proto.render = function render() {
|
|
273
249
|
if (this.props.ids) {
|
|
274
250
|
return this._renderAccessibleChildren(this.props.ids);
|
|
275
251
|
}
|
|
276
|
-
|
|
277
252
|
return this._renderAnchorableChildren();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
}
|
|
253
|
+
};
|
|
254
|
+
return TooltipAnchor;
|
|
255
|
+
}(React__namespace.Component);
|
|
281
256
|
TooltipAnchor.defaultProps = {
|
|
282
257
|
forceAnchorFocusivity: true
|
|
283
258
|
};
|
|
284
259
|
TooltipAnchor.ariaContentId = "aria-content";
|
|
285
260
|
|
|
261
|
+
function _extends() {
|
|
262
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
263
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
264
|
+
var source = arguments[i];
|
|
265
|
+
for (var key in source) {
|
|
266
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
267
|
+
target[key] = source[key];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return target;
|
|
272
|
+
};
|
|
273
|
+
return _extends.apply(this, arguments);
|
|
274
|
+
}
|
|
275
|
+
|
|
286
276
|
let tempIdCounter = 0;
|
|
287
|
-
|
|
288
|
-
|
|
277
|
+
let TooltipTail = function (_React$Component) {
|
|
278
|
+
_inheritsLoose(TooltipTail, _React$Component);
|
|
279
|
+
function TooltipTail() {
|
|
280
|
+
return _React$Component.apply(this, arguments) || this;
|
|
281
|
+
}
|
|
282
|
+
var _proto = TooltipTail.prototype;
|
|
283
|
+
_proto._calculateDimensionsFromPlacement = function _calculateDimensionsFromPlacement() {
|
|
289
284
|
const {
|
|
290
285
|
placement
|
|
291
286
|
} = this.props;
|
|
292
287
|
const trimlineOffset = 0.5;
|
|
293
|
-
|
|
294
288
|
switch (placement) {
|
|
295
289
|
case "top":
|
|
296
290
|
return {
|
|
@@ -299,7 +293,6 @@ class TooltipTail extends React__namespace.Component {
|
|
|
299
293
|
height: ARROW_HEIGHT,
|
|
300
294
|
width: ARROW_WIDTH
|
|
301
295
|
};
|
|
302
|
-
|
|
303
296
|
case "right":
|
|
304
297
|
return {
|
|
305
298
|
trimlinePoints: [`${ARROW_HEIGHT + trimlineOffset},0`, `${ARROW_HEIGHT + trimlineOffset},${ARROW_WIDTH}`],
|
|
@@ -307,7 +300,6 @@ class TooltipTail extends React__namespace.Component {
|
|
|
307
300
|
width: ARROW_HEIGHT,
|
|
308
301
|
height: ARROW_WIDTH
|
|
309
302
|
};
|
|
310
|
-
|
|
311
303
|
case "bottom":
|
|
312
304
|
return {
|
|
313
305
|
trimlinePoints: [`0, ${ARROW_HEIGHT + trimlineOffset}`, `${ARROW_WIDTH},${ARROW_HEIGHT + trimlineOffset}`],
|
|
@@ -315,7 +307,6 @@ class TooltipTail extends React__namespace.Component {
|
|
|
315
307
|
width: ARROW_WIDTH,
|
|
316
308
|
height: ARROW_HEIGHT
|
|
317
309
|
};
|
|
318
|
-
|
|
319
310
|
case "left":
|
|
320
311
|
return {
|
|
321
312
|
trimlinePoints: [`-${trimlineOffset},0`, `-${trimlineOffset},${ARROW_WIDTH}`],
|
|
@@ -323,17 +314,14 @@ class TooltipTail extends React__namespace.Component {
|
|
|
323
314
|
width: ARROW_HEIGHT,
|
|
324
315
|
height: ARROW_WIDTH
|
|
325
316
|
};
|
|
326
|
-
|
|
327
317
|
default:
|
|
328
318
|
throw new Error(`Unknown placement: ${placement}`);
|
|
329
319
|
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
_getFilterPositioning() {
|
|
320
|
+
};
|
|
321
|
+
_proto._getFilterPositioning = function _getFilterPositioning() {
|
|
333
322
|
const {
|
|
334
323
|
placement
|
|
335
324
|
} = this.props;
|
|
336
|
-
|
|
337
325
|
switch (placement) {
|
|
338
326
|
case "top":
|
|
339
327
|
return {
|
|
@@ -341,36 +329,29 @@ class TooltipTail extends React__namespace.Component {
|
|
|
341
329
|
x: "-50%",
|
|
342
330
|
offsetShadowX: 0
|
|
343
331
|
};
|
|
344
|
-
|
|
345
332
|
case "bottom":
|
|
346
333
|
return null;
|
|
347
|
-
|
|
348
334
|
case "left":
|
|
349
335
|
return {
|
|
350
336
|
y: "-50%",
|
|
351
337
|
x: "0%",
|
|
352
338
|
offsetShadowX: 1
|
|
353
339
|
};
|
|
354
|
-
|
|
355
340
|
case "right":
|
|
356
341
|
return {
|
|
357
342
|
y: "-50%",
|
|
358
343
|
x: "-100%",
|
|
359
344
|
offsetShadowX: -1
|
|
360
345
|
};
|
|
361
|
-
|
|
362
346
|
default:
|
|
363
347
|
throw new Error(`Unknown placement: ${placement}`);
|
|
364
348
|
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
_maybeRenderDropshadow(points) {
|
|
349
|
+
};
|
|
350
|
+
_proto._maybeRenderDropshadow = function _maybeRenderDropshadow(points) {
|
|
368
351
|
const position = this._getFilterPositioning();
|
|
369
|
-
|
|
370
352
|
if (!position) {
|
|
371
353
|
return null;
|
|
372
354
|
}
|
|
373
|
-
|
|
374
355
|
const {
|
|
375
356
|
placement
|
|
376
357
|
} = this.props;
|
|
@@ -402,25 +383,19 @@ class TooltipTail extends React__namespace.Component {
|
|
|
402
383
|
stroke: Colors__default["default"].offBlack32,
|
|
403
384
|
filter: `url(#${dropShadowFilterId})`
|
|
404
385
|
}))];
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
_getFullTailWidth() {
|
|
386
|
+
};
|
|
387
|
+
_proto._getFullTailWidth = function _getFullTailWidth() {
|
|
408
388
|
return ARROW_WIDTH + 2 * MIN_DISTANCE_FROM_CORNERS;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
_getFullTailHeight() {
|
|
389
|
+
};
|
|
390
|
+
_proto._getFullTailHeight = function _getFullTailHeight() {
|
|
412
391
|
return ARROW_HEIGHT + DISTANCE_FROM_ANCHOR;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
_getContainerStyle() {
|
|
392
|
+
};
|
|
393
|
+
_proto._getContainerStyle = function _getContainerStyle() {
|
|
416
394
|
const {
|
|
417
395
|
placement
|
|
418
396
|
} = this.props;
|
|
419
|
-
|
|
420
397
|
const fullTailWidth = this._getFullTailWidth();
|
|
421
|
-
|
|
422
398
|
const fullTailHeight = this._getFullTailHeight();
|
|
423
|
-
|
|
424
399
|
switch (placement) {
|
|
425
400
|
case "top":
|
|
426
401
|
return {
|
|
@@ -428,38 +403,32 @@ class TooltipTail extends React__namespace.Component {
|
|
|
428
403
|
width: fullTailWidth,
|
|
429
404
|
height: fullTailHeight
|
|
430
405
|
};
|
|
431
|
-
|
|
432
406
|
case "right":
|
|
433
407
|
return {
|
|
434
408
|
left: 1,
|
|
435
409
|
width: fullTailHeight,
|
|
436
410
|
height: fullTailWidth
|
|
437
411
|
};
|
|
438
|
-
|
|
439
412
|
case "bottom":
|
|
440
413
|
return {
|
|
441
414
|
top: 1,
|
|
442
415
|
width: fullTailWidth,
|
|
443
416
|
height: fullTailHeight
|
|
444
417
|
};
|
|
445
|
-
|
|
446
418
|
case "left":
|
|
447
419
|
return {
|
|
448
420
|
left: -1,
|
|
449
421
|
width: fullTailHeight,
|
|
450
422
|
height: fullTailWidth
|
|
451
423
|
};
|
|
452
|
-
|
|
453
424
|
default:
|
|
454
425
|
throw new Error(`Unknown placement: ${placement}`);
|
|
455
426
|
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
_getArrowStyle() {
|
|
427
|
+
};
|
|
428
|
+
_proto._getArrowStyle = function _getArrowStyle() {
|
|
459
429
|
const {
|
|
460
430
|
placement
|
|
461
431
|
} = this.props;
|
|
462
|
-
|
|
463
432
|
switch (placement) {
|
|
464
433
|
case "top":
|
|
465
434
|
return {
|
|
@@ -467,41 +436,35 @@ class TooltipTail extends React__namespace.Component {
|
|
|
467
436
|
marginRight: MIN_DISTANCE_FROM_CORNERS,
|
|
468
437
|
paddingBottom: DISTANCE_FROM_ANCHOR
|
|
469
438
|
};
|
|
470
|
-
|
|
471
439
|
case "right":
|
|
472
440
|
return {
|
|
473
441
|
marginTop: MIN_DISTANCE_FROM_CORNERS,
|
|
474
442
|
marginBottom: MIN_DISTANCE_FROM_CORNERS,
|
|
475
443
|
paddingLeft: DISTANCE_FROM_ANCHOR
|
|
476
444
|
};
|
|
477
|
-
|
|
478
445
|
case "bottom":
|
|
479
446
|
return {
|
|
480
447
|
marginLeft: MIN_DISTANCE_FROM_CORNERS,
|
|
481
448
|
marginRight: MIN_DISTANCE_FROM_CORNERS,
|
|
482
449
|
paddingTop: DISTANCE_FROM_ANCHOR
|
|
483
450
|
};
|
|
484
|
-
|
|
485
451
|
case "left":
|
|
486
452
|
return {
|
|
487
453
|
marginTop: MIN_DISTANCE_FROM_CORNERS,
|
|
488
454
|
marginBottom: MIN_DISTANCE_FROM_CORNERS,
|
|
489
455
|
paddingRight: DISTANCE_FROM_ANCHOR
|
|
490
456
|
};
|
|
491
|
-
|
|
492
457
|
default:
|
|
493
458
|
throw new Error(`Unknown placement: ${placement}`);
|
|
494
459
|
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
_renderArrow() {
|
|
460
|
+
};
|
|
461
|
+
_proto._renderArrow = function _renderArrow() {
|
|
498
462
|
const {
|
|
499
463
|
trimlinePoints,
|
|
500
464
|
points,
|
|
501
465
|
height,
|
|
502
466
|
width
|
|
503
467
|
} = this._calculateDimensionsFromPlacement();
|
|
504
|
-
|
|
505
468
|
const {
|
|
506
469
|
color
|
|
507
470
|
} = this.props;
|
|
@@ -523,22 +486,21 @@ class TooltipTail extends React__namespace.Component {
|
|
|
523
486
|
stroke: Colors__default["default"][color],
|
|
524
487
|
points: trimlinePoints.join(" ")
|
|
525
488
|
}));
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
render() {
|
|
489
|
+
};
|
|
490
|
+
_proto.render = function render() {
|
|
529
491
|
const {
|
|
530
492
|
offset,
|
|
531
493
|
placement,
|
|
532
494
|
updateRef
|
|
533
495
|
} = this.props;
|
|
534
496
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
535
|
-
style: [styles$2.tailContainer,
|
|
497
|
+
style: [styles$2.tailContainer, _extends({}, offset), this._getContainerStyle()],
|
|
536
498
|
"data-placement": placement,
|
|
537
499
|
ref: updateRef
|
|
538
500
|
}, this._renderArrow());
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
}
|
|
501
|
+
};
|
|
502
|
+
return TooltipTail;
|
|
503
|
+
}(React__namespace.Component);
|
|
542
504
|
TooltipTail.defaultProps = {
|
|
543
505
|
color: "white"
|
|
544
506
|
};
|
|
@@ -556,30 +518,30 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
556
518
|
}
|
|
557
519
|
});
|
|
558
520
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
521
|
+
let TooltipBubble = function (_React$Component) {
|
|
522
|
+
_inheritsLoose(TooltipBubble, _React$Component);
|
|
523
|
+
function TooltipBubble(...args) {
|
|
524
|
+
var _this;
|
|
525
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
526
|
+
_this.state = {
|
|
563
527
|
active: false
|
|
564
528
|
};
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
this._setActiveState(true);
|
|
529
|
+
_this.handleMouseEnter = () => {
|
|
530
|
+
_this._setActiveState(true);
|
|
568
531
|
};
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
this.props.onActiveChanged(false);
|
|
532
|
+
_this.handleMouseLeave = () => {
|
|
533
|
+
_this.props.onActiveChanged(false);
|
|
572
534
|
};
|
|
535
|
+
return _this;
|
|
573
536
|
}
|
|
574
|
-
|
|
575
|
-
_setActiveState(active) {
|
|
537
|
+
var _proto = TooltipBubble.prototype;
|
|
538
|
+
_proto._setActiveState = function _setActiveState(active) {
|
|
576
539
|
this.setState({
|
|
577
540
|
active
|
|
578
541
|
});
|
|
579
542
|
this.props.onActiveChanged(active);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
render() {
|
|
543
|
+
};
|
|
544
|
+
_proto.render = function render() {
|
|
583
545
|
const {
|
|
584
546
|
id,
|
|
585
547
|
children,
|
|
@@ -605,9 +567,9 @@ class TooltipBubble extends React__namespace.Component {
|
|
|
605
567
|
placement: placement,
|
|
606
568
|
offset: tailOffset
|
|
607
569
|
}));
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
}
|
|
570
|
+
};
|
|
571
|
+
return TooltipBubble;
|
|
572
|
+
}(React__namespace.Component);
|
|
611
573
|
const styles$1 = aphrodite.StyleSheet.create({
|
|
612
574
|
bubble: {
|
|
613
575
|
position: "absolute"
|
|
@@ -640,12 +602,16 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
640
602
|
}
|
|
641
603
|
});
|
|
642
604
|
|
|
643
|
-
|
|
644
|
-
|
|
605
|
+
let TooltipContent = function (_React$Component) {
|
|
606
|
+
_inheritsLoose(TooltipContent, _React$Component);
|
|
607
|
+
function TooltipContent() {
|
|
608
|
+
return _React$Component.apply(this, arguments) || this;
|
|
609
|
+
}
|
|
610
|
+
var _proto = TooltipContent.prototype;
|
|
611
|
+
_proto._renderTitle = function _renderTitle() {
|
|
645
612
|
const {
|
|
646
613
|
title
|
|
647
614
|
} = this.props;
|
|
648
|
-
|
|
649
615
|
if (title) {
|
|
650
616
|
if (typeof title === "string") {
|
|
651
617
|
return React__namespace.createElement(wonderBlocksTypography.HeadingSmall, null, title);
|
|
@@ -653,36 +619,30 @@ class TooltipContent extends React__namespace.Component {
|
|
|
653
619
|
return title;
|
|
654
620
|
}
|
|
655
621
|
}
|
|
656
|
-
|
|
657
622
|
return null;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
_renderChildren() {
|
|
623
|
+
};
|
|
624
|
+
_proto._renderChildren = function _renderChildren() {
|
|
661
625
|
const {
|
|
662
626
|
children
|
|
663
627
|
} = this.props;
|
|
664
|
-
|
|
665
628
|
if (typeof children === "string") {
|
|
666
629
|
return React__namespace.createElement(wonderBlocksTypography.LabelMedium, null, children);
|
|
667
630
|
} else {
|
|
668
631
|
return children;
|
|
669
632
|
}
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
render() {
|
|
633
|
+
};
|
|
634
|
+
_proto.render = function render() {
|
|
673
635
|
const title = this._renderTitle();
|
|
674
|
-
|
|
675
636
|
const children = this._renderChildren();
|
|
676
|
-
|
|
677
637
|
const containerStyle = title ? styles.withTitle : styles.withoutTitle;
|
|
678
638
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
679
639
|
style: containerStyle
|
|
680
640
|
}, title, title && children && React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
681
641
|
size: Spacing__default["default"].xxxSmall_4
|
|
682
642
|
}), children);
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
}
|
|
643
|
+
};
|
|
644
|
+
return TooltipContent;
|
|
645
|
+
}(React__namespace.Component);
|
|
686
646
|
const styles = aphrodite.StyleSheet.create({
|
|
687
647
|
withoutTitle: {
|
|
688
648
|
padding: `10px ${Spacing__default["default"].medium_16}px`
|
|
@@ -692,53 +652,49 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
692
652
|
}
|
|
693
653
|
});
|
|
694
654
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
655
|
+
let RefTracker = function RefTracker() {
|
|
656
|
+
this._lastRef = void 0;
|
|
657
|
+
this._targetFn = void 0;
|
|
658
|
+
this.updateRef = ref => {
|
|
659
|
+
if (ref) {
|
|
660
|
+
const domNode = ReactDOM__namespace.findDOMNode(ref);
|
|
661
|
+
if (domNode instanceof HTMLElement && domNode !== this._lastRef) {
|
|
662
|
+
var _this$_targetFn;
|
|
663
|
+
this._lastRef = domNode;
|
|
664
|
+
(_this$_targetFn = this._targetFn) == null ? void 0 : _this$_targetFn.call(this, domNode);
|
|
705
665
|
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
this._targetFn = targetFn || null;
|
|
715
|
-
|
|
716
|
-
if (this._lastRef && this._targetFn) {
|
|
717
|
-
this._targetFn(this._lastRef);
|
|
718
|
-
}
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
this.setCallback = targetFn => {
|
|
669
|
+
if (this._targetFn !== targetFn) {
|
|
670
|
+
if (targetFn && typeof targetFn !== "function") {
|
|
671
|
+
throw new Error("targetFn must be a function");
|
|
719
672
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
super(...args);
|
|
728
|
-
this._bubbleRefTracker = new RefTracker();
|
|
729
|
-
this._tailRefTracker = new RefTracker();
|
|
730
|
-
}
|
|
673
|
+
this._targetFn = targetFn || null;
|
|
674
|
+
if (this._lastRef && this._targetFn) {
|
|
675
|
+
this._targetFn(this._lastRef);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
};
|
|
731
680
|
|
|
732
|
-
|
|
681
|
+
let TooltipPopper = function (_React$Component) {
|
|
682
|
+
_inheritsLoose(TooltipPopper, _React$Component);
|
|
683
|
+
function TooltipPopper(...args) {
|
|
684
|
+
var _this;
|
|
685
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
686
|
+
_this._bubbleRefTracker = new RefTracker();
|
|
687
|
+
_this._tailRefTracker = new RefTracker();
|
|
688
|
+
return _this;
|
|
689
|
+
}
|
|
690
|
+
var _proto = TooltipPopper.prototype;
|
|
691
|
+
_proto._renderPositionedContent = function _renderPositionedContent(popperProps) {
|
|
733
692
|
const {
|
|
734
693
|
children
|
|
735
694
|
} = this.props;
|
|
736
695
|
const placement = popperProps.placement || this.props.placement;
|
|
737
|
-
|
|
738
696
|
this._bubbleRefTracker.setCallback(popperProps.ref);
|
|
739
|
-
|
|
740
697
|
this._tailRefTracker.setCallback(popperProps.arrowProps.ref);
|
|
741
|
-
|
|
742
698
|
const bubbleProps = {
|
|
743
699
|
placement,
|
|
744
700
|
style: {
|
|
@@ -761,9 +717,8 @@ class TooltipPopper extends React__namespace.Component {
|
|
|
761
717
|
isReferenceHidden: popperProps.isReferenceHidden
|
|
762
718
|
};
|
|
763
719
|
return children(bubbleProps);
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
render() {
|
|
720
|
+
};
|
|
721
|
+
_proto.render = function render() {
|
|
767
722
|
const {
|
|
768
723
|
anchorElement,
|
|
769
724
|
placement
|
|
@@ -779,40 +734,40 @@ class TooltipPopper extends React__namespace.Component {
|
|
|
779
734
|
}
|
|
780
735
|
}]
|
|
781
736
|
}, props => this._renderPositionedContent(props));
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
737
|
+
};
|
|
738
|
+
return TooltipPopper;
|
|
739
|
+
}(React__namespace.Component);
|
|
740
|
+
|
|
741
|
+
let Tooltip = function (_React$Component) {
|
|
742
|
+
_inheritsLoose(Tooltip, _React$Component);
|
|
743
|
+
function Tooltip(...args) {
|
|
744
|
+
var _this;
|
|
745
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
746
|
+
_this.state = {
|
|
790
747
|
active: false,
|
|
791
748
|
activeBubble: false,
|
|
792
749
|
anchorElement: null
|
|
793
750
|
};
|
|
751
|
+
return _this;
|
|
794
752
|
}
|
|
795
|
-
|
|
796
|
-
static getDerivedStateFromProps(props, state) {
|
|
753
|
+
Tooltip.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
|
797
754
|
return {
|
|
798
755
|
active: typeof props.opened === "boolean" ? props.opened : state.active
|
|
799
756
|
};
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
_updateAnchorElement(ref) {
|
|
757
|
+
};
|
|
758
|
+
var _proto = Tooltip.prototype;
|
|
759
|
+
_proto._updateAnchorElement = function _updateAnchorElement(ref) {
|
|
803
760
|
if (ref && ref !== this.state.anchorElement) {
|
|
804
761
|
this.setState({
|
|
805
762
|
anchorElement: ref
|
|
806
763
|
});
|
|
807
764
|
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
_renderBubbleContent() {
|
|
765
|
+
};
|
|
766
|
+
_proto._renderBubbleContent = function _renderBubbleContent() {
|
|
811
767
|
const {
|
|
812
768
|
title,
|
|
813
769
|
content
|
|
814
770
|
} = this.props;
|
|
815
|
-
|
|
816
771
|
if (typeof content === "string") {
|
|
817
772
|
return React__namespace.createElement(TooltipContent, {
|
|
818
773
|
title: title
|
|
@@ -824,18 +779,15 @@ class Tooltip extends React__namespace.Component {
|
|
|
824
779
|
} else {
|
|
825
780
|
return content;
|
|
826
781
|
}
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
_renderPopper(ids) {
|
|
782
|
+
};
|
|
783
|
+
_proto._renderPopper = function _renderPopper(ids) {
|
|
830
784
|
const {
|
|
831
785
|
id
|
|
832
786
|
} = this.props;
|
|
833
787
|
const bubbleId = ids ? ids.get(Tooltip.ariaContentId) : id;
|
|
834
|
-
|
|
835
788
|
if (!bubbleId) {
|
|
836
789
|
throw new Error("Did not get an identifier factory nor a id prop");
|
|
837
790
|
}
|
|
838
|
-
|
|
839
791
|
const {
|
|
840
792
|
placement
|
|
841
793
|
} = this.props;
|
|
@@ -854,16 +806,14 @@ class Tooltip extends React__namespace.Component {
|
|
|
854
806
|
activeBubble: active
|
|
855
807
|
})
|
|
856
808
|
}, this._renderBubbleContent()));
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
_getHost() {
|
|
809
|
+
};
|
|
810
|
+
_proto._getHost = function _getHost() {
|
|
860
811
|
const {
|
|
861
812
|
anchorElement
|
|
862
813
|
} = this.state;
|
|
863
814
|
return wonderBlocksModal.maybeGetPortalMountedModalHostElement(anchorElement) || document.body;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
_renderTooltipAnchor(ids) {
|
|
815
|
+
};
|
|
816
|
+
_proto._renderTooltipAnchor = function _renderTooltipAnchor(ids) {
|
|
867
817
|
const {
|
|
868
818
|
children,
|
|
869
819
|
forceAnchorFocusivity
|
|
@@ -872,9 +822,7 @@ class Tooltip extends React__namespace.Component {
|
|
|
872
822
|
active,
|
|
873
823
|
activeBubble
|
|
874
824
|
} = this.state;
|
|
875
|
-
|
|
876
825
|
const popperHost = this._getHost();
|
|
877
|
-
|
|
878
826
|
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(TooltipAnchor, {
|
|
879
827
|
forceAnchorFocusivity: forceAnchorFocusivity,
|
|
880
828
|
anchorRef: r => this._updateAnchorElement(r),
|
|
@@ -883,13 +831,11 @@ class Tooltip extends React__namespace.Component {
|
|
|
883
831
|
}),
|
|
884
832
|
ids: ids
|
|
885
833
|
}, children), popperHost && (active || activeBubble) && ReactDOM__namespace.createPortal(this._renderPopper(ids), popperHost));
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
render() {
|
|
834
|
+
};
|
|
835
|
+
_proto.render = function render() {
|
|
889
836
|
const {
|
|
890
837
|
id
|
|
891
838
|
} = this.props;
|
|
892
|
-
|
|
893
839
|
if (id) {
|
|
894
840
|
return this._renderTooltipAnchor();
|
|
895
841
|
} else {
|
|
@@ -898,9 +844,9 @@ class Tooltip extends React__namespace.Component {
|
|
|
898
844
|
mockOnFirstRender: true
|
|
899
845
|
}, ids => this._renderTooltipAnchor(ids));
|
|
900
846
|
}
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
}
|
|
847
|
+
};
|
|
848
|
+
return Tooltip;
|
|
849
|
+
}(React__namespace.Component);
|
|
904
850
|
Tooltip.defaultProps = {
|
|
905
851
|
forceAnchorFocusivity: true,
|
|
906
852
|
placement: "top"
|